Only re-try AcceptTCP() if the error is temporary

This commit is contained in:
Bryan Boreham 2015-10-30 17:08:27 +00:00
parent adeb323cbc
commit e54a6cf1bc
1 changed files with 4 additions and 1 deletions

View File

@ -434,7 +434,10 @@ func (srv *Server) serveTCP(l *net.TCPListener) error {
for {
rw, e := l.AcceptTCP()
if e != nil {
continue
if neterr, ok := e.(net.Error); ok && neterr.Temporary() {
continue
}
return e
}
m, e := reader.ReadTCP(rw, rtimeout)
srv.lock.RLock()