diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-18 23:34:05 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-18 23:34:05 +0900 |
commit | c34707d670c0944162b01198d93c78c957286830 (patch) | |
tree | 6ef093ccd78059e62da149aedd18e8ba07db629f /server/server.go | |
parent | 97c124246d0b2e714d57eca814f95c0a82d97113 (diff) |
server: make sure peer always read from acceptedConnCh
When acceptedConnCh is full, the server goroutine will be
blocked. It's not good even eventually the goroutine will run. This
situation happens only with buggy bgp speaerk peers. But let's avoid
this anyway.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/server/server.go b/server/server.go index 5823859a..cbd67732 100644 --- a/server/server.go +++ b/server/server.go @@ -106,9 +106,7 @@ func (server *BgpServer) Serve() { server.bgpConfig.Global = <-server.globalTypeCh listenerMap := make(map[string]*net.TCPListener) - // workaround: we should close an accepted connection - // immediately if we are not in the state we continue? - acceptCh := make(chan *net.TCPConn, 4) + acceptCh := make(chan *net.TCPConn) l4, err1 := listenAndAccept("tcp4", server.listenPort, acceptCh) listenerMap["tcp4"] = l4 l6, err2 := listenAndAccept("tcp6", server.listenPort, acceptCh) |