Skip to content

Commit

Permalink
node: report actual port used for http rpc (ethereum#20789)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Nov 4, 2024
1 parent 683709a commit 3719db0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
if err != nil {
return err
}
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%s", endpoint), "cors", strings.Join(cors, ","), "vhosts", strings.Join(vhosts, ","))
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%v/", listener.Addr()),
"cors", strings.Join(cors, ","),
"vhosts", strings.Join(vhosts, ","))
// All listeners booted successfully
n.httpEndpoint = endpoint
n.httpListener = listener
Expand All @@ -369,10 +371,10 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
// stopHTTP terminates the HTTP RPC endpoint.
func (n *Node) stopHTTP() {
if n.httpListener != nil {
url := fmt.Sprintf("http://%v/", n.httpListener.Addr())
n.httpListener.Close()
n.httpListener = nil

n.log.Info("HTTP endpoint closed", "url", fmt.Sprintf("http://%s", n.httpEndpoint))
n.log.Info("HTTP endpoint closed", "url", url)
}
if n.httpHandler != nil {
n.httpHandler.Stop()
Expand Down

0 comments on commit 3719db0

Please sign in to comment.