Do not log 'use of closed network connection' error when closing listener in Server.Serve*

This commit is contained in:
Aliaksandr Valialkin
2015-11-12 19:53:17 +02:00
parent 039f2d074e
commit 33c0dd1fe2
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"log"
"net"
"os"
"strings"
"sync"
"sync/atomic"
"time"
@@ -320,7 +321,7 @@ func acceptConn(s *Server, ln net.Listener, lastPerIPErrorTime *time.Time) (net.
time.Sleep(time.Second)
continue
}
if err != io.EOF {
if err != io.EOF && !strings.Contains(err.Error(), "use of closed network connection") {
s.logger().Printf("Permanent error when accepting new connections: %s", err)
}
return nil, err