server-mux: Keep listening after Accept() err (#3613)

Accept() can return errors like: `too many open files`, no need to totally quit listening in this case.
master
Anis Elleuch 8 years ago committed by Harshavardhana
parent d1d89116f1
commit fc6f804865
  1. 16
      cmd/server-mux.go

@ -191,20 +191,20 @@ func newListenerMux(listener net.Listener, config *tls.Config) *ListenerMux {
}
// Start listening, wrap connections with tls when needed
go func() {
// Extract tcp listener.
tcpListener, ok := l.Listener.(*net.TCPListener)
if !ok {
l.acceptResCh <- ListenerMuxAcceptRes{err: errInvalidArgument}
return
}
// Loop for accepting new connections
for {
// Extract tcp listener.
tcpListener, ok := l.Listener.(*net.TCPListener)
if !ok {
l.acceptResCh <- ListenerMuxAcceptRes{err: errInvalidArgument}
return
}
// Use accept TCP method to receive the connection.
conn, err := tcpListener.AcceptTCP()
if err != nil {
l.acceptResCh <- ListenerMuxAcceptRes{err: err}
return
continue
}
// Enable Read timeout

Loading…
Cancel
Save