Merge pull request #283 from bboreham/spin-less
Only re-try AcceptTCP() if the error is temporary
This commit is contained in:
commit
6a1556664f
|
@ -434,7 +434,10 @@ func (srv *Server) serveTCP(l *net.TCPListener) error {
|
||||||
for {
|
for {
|
||||||
rw, e := l.AcceptTCP()
|
rw, e := l.AcceptTCP()
|
||||||
if e != nil {
|
if e != nil {
|
||||||
continue
|
if neterr, ok := e.(net.Error); ok && neterr.Temporary() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return e
|
||||||
}
|
}
|
||||||
m, e := reader.ReadTCP(rw, rtimeout)
|
m, e := reader.ReadTCP(rw, rtimeout)
|
||||||
srv.lock.RLock()
|
srv.lock.RLock()
|
||||||
|
|
Loading…
Reference in New Issue