0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-06 22:40:31 -05:00

httpserver: Ignore ErrServerClosed when closing server

This commit is contained in:
Matthew Holt 2018-04-02 08:17:21 -06:00
parent b33b24fc9e
commit 917a604094
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
2 changed files with 4 additions and 1 deletions

View file

@ -798,7 +798,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
continue
}
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
}
log.Println(err)

View file

@ -319,6 +319,9 @@ func (s *Server) Serve(ln net.Listener) error {
}
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 {
s.quicServer.Close()
}