mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-02 14:17:01 +01:00
httpserver: Ignore ErrServerClosed when closing server
This commit is contained in:
parent
b33b24fc9e
commit
917a604094
2 changed files with 4 additions and 1 deletions
2
caddy.go
2
caddy.go
|
@ -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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue