diff options
Diffstat (limited to 'node/node.go')
-rw-r--r-- | node/node.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/node/node.go b/node/node.go index ada383721..85299dba7 100644 --- a/node/node.go +++ b/node/node.go @@ -549,11 +549,23 @@ func (n *Node) IPCEndpoint() string { // HTTPEndpoint retrieves the current HTTP endpoint used by the protocol stack. func (n *Node) HTTPEndpoint() string { + n.lock.Lock() + defer n.lock.Unlock() + + if n.httpListener != nil { + return n.httpListener.Addr().String() + } return n.httpEndpoint } // WSEndpoint retrieves the current WS endpoint used by the protocol stack. func (n *Node) WSEndpoint() string { + n.lock.Lock() + defer n.lock.Unlock() + + if n.wsListener != nil { + return n.wsListener.Addr().String() + } return n.wsEndpoint } |