diff --git a/p2p/server.go b/p2p/server.go index dd52297f8a9c..e6cdeb34cea5 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -854,13 +854,16 @@ func (srv *Server) listenLoop() { <-slots var ( - fd net.Conn - err error + fd net.Conn + err error + tmpErrors = uint64(0) ) for { fd, err = srv.listener.Accept() - if netutil.IsTemporaryError(err) { + if netutil.IsTemporaryError(err) && tmpErrors < 200 { srv.log.Debug("Temporary read error", "err", err) + tmpErrors++ + time.Sleep(time.Millisecond * 10) continue } else if err != nil { srv.log.Debug("Read error", "err", err) @@ -869,6 +872,7 @@ func (srv *Server) listenLoop() { } break } + tmpErrors = 0 remoteIP := netutil.AddrIP(fd.RemoteAddr()) if err := srv.checkInboundConn(fd, remoteIP); err != nil {