mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
parent
5199446cb6
commit
acc9371b8b
1 changed files with 3 additions and 1 deletions
|
|
@ -276,13 +276,15 @@ func (h *httpServer) doStop() {
|
||||||
h.wsHandler.Store((*rpcHandler)(nil))
|
h.wsHandler.Store((*rpcHandler)(nil))
|
||||||
wsHandler.server.Stop()
|
wsHandler.server.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
err := h.server.Shutdown(ctx)
|
err := h.server.Shutdown(ctx)
|
||||||
if err == ctx.Err() {
|
if err != nil && err == ctx.Err() {
|
||||||
h.log.Warn("HTTP server graceful shutdown timed out")
|
h.log.Warn("HTTP server graceful shutdown timed out")
|
||||||
h.server.Close()
|
h.server.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
h.listener.Close()
|
h.listener.Close()
|
||||||
h.log.Info("HTTP server stopped", "endpoint", h.listener.Addr())
|
h.log.Info("HTTP server stopped", "endpoint", h.listener.Addr())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue