Recover lost HTTP server lifecycle log messages

This commit is contained in:
Steven E. Harris 2020-04-22 16:53:55 -04:00
parent bae9069f98
commit 45e2022079

View file

@ -407,6 +407,7 @@ func (n *Node) stopHTTP() {
if n.httpServer != nil { if n.httpServer != nil {
// Don't bother imposing a timeout here. // Don't bother imposing a timeout here.
n.httpServer.Shutdown(context.Background()) n.httpServer.Shutdown(context.Background())
n.log.Info("HTTP endpoint closed", "url", fmt.Sprintf("http://%v/", n.httpListenerAddr))
} }
if n.httpHandler != nil { if n.httpHandler != nil {
n.httpHandler.Stop() n.httpHandler.Stop()
@ -431,7 +432,7 @@ func (n *Node) startWS(endpoint string, apis []rpc.API, modules []string, wsOrig
if err != nil { if err != nil {
return err return err
} }
n.log.Info("WebSocket endpoint opened", "url", fmt.Sprintf("ws://%s", addr)) n.log.Info("WebSocket endpoint opened", "url", fmt.Sprintf("ws://%v", addr))
// All listeners booted successfully // All listeners booted successfully
n.wsEndpoint = endpoint n.wsEndpoint = endpoint
n.wsListenerAddr = addr n.wsListenerAddr = addr
@ -446,6 +447,7 @@ func (n *Node) stopWS() {
if n.wsHTTPServer != nil { if n.wsHTTPServer != nil {
// Don't bother imposing a timeout here. // Don't bother imposing a timeout here.
n.wsHTTPServer.Shutdown(context.Background()) n.wsHTTPServer.Shutdown(context.Background())
n.log.Info("WebSocket endpoint closed", "url", fmt.Sprintf("ws://%v", n.wsListenerAddr))
} }
if n.wsHandler != nil { if n.wsHandler != nil {
n.wsHandler.Stop() n.wsHandler.Stop()