Commit 917a6040 authored by Matthew Holt's avatar Matthew Holt

httpserver: Ignore ErrServerClosed when closing server

parent b33b24fc
...@@ -798,7 +798,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res ...@@ -798,7 +798,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
continue continue
} }
if strings.Contains(err.Error(), "use of closed network connection") { if strings.Contains(err.Error(), "use of closed network connection") {
// this error is normal when closing the listener // this error is normal when closing the listener; see https://github.com/golang/go/issues/4373
continue continue
} }
log.Println(err) log.Println(err)
......
...@@ -319,6 +319,9 @@ func (s *Server) Serve(ln net.Listener) error { ...@@ -319,6 +319,9 @@ func (s *Server) Serve(ln net.Listener) error {
} }
err := s.Server.Serve(ln) err := s.Server.Serve(ln)
if err == http.ErrServerClosed {
err = nil // not an error worth reporting since closing a server is intentional
}
if s.quicServer != nil { if s.quicServer != nil {
s.quicServer.Close() s.quicServer.Close()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment