From a21a3e0f82672843b527960bba188845006d4d58 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 20 Mar 2020 10:13:41 +0100 Subject: [PATCH 1/3] node, cmd/clef: report actual port used for http rpc --- cmd/clef/main.go | 4 ++-- node/node.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/clef/main.go b/cmd/clef/main.go index b2c8812ab269..7dcd99b4be0f 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -545,12 +545,12 @@ func signer(c *cli.Context) error { if err != nil { utils.Fatalf("Could not start RPC api: %v", err) } - extapiURL = fmt.Sprintf("http://%s", httpEndpoint) + extapiURL = fmt.Sprintf("http://%v", listener.Addr()) log.Info("HTTP endpoint opened", "url", extapiURL) defer func() { listener.Close() - log.Info("HTTP endpoint closed", "url", httpEndpoint) + log.Info("HTTP endpoint closed", "url", extapiURL) }() } if !c.GlobalBool(utils.IPCDisabledFlag.Name) { diff --git a/node/node.go b/node/node.go index 1bdd5af7d2f1..06923b0872fa 100644 --- a/node/node.go +++ b/node/node.go @@ -368,7 +368,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 @@ -380,10 +382,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() From 2aefb28b36b1845ebc3b8560a9f7ab0b0409f544 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 23 Mar 2020 09:26:50 +0100 Subject: [PATCH 2/3] Update cmd/clef/main.go --- cmd/clef/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/clef/main.go b/cmd/clef/main.go index 7dcd99b4be0f..dd898871d5b9 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -545,7 +545,7 @@ func signer(c *cli.Context) error { if err != nil { utils.Fatalf("Could not start RPC api: %v", err) } - extapiURL = fmt.Sprintf("http://%v", listener.Addr()) + extapiURL = fmt.Sprintf("http://%v/", listener.Addr()) log.Info("HTTP endpoint opened", "url", extapiURL) defer func() { From f033c8d3edaf739a951c51ec179934f20f50df6f Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 23 Mar 2020 09:26:56 +0100 Subject: [PATCH 3/3] Update node/node.go --- node/node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.go b/node/node.go index 06923b0872fa..7d8f9b07b94e 100644 --- a/node/node.go +++ b/node/node.go @@ -382,7 +382,7 @@ 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()) + url := fmt.Sprintf("http://%v/", n.httpListener.Addr()) n.httpListener.Close() n.httpListener = nil n.log.Info("HTTP endpoint closed", "url", url)