mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 18:00:46 +00:00
node: fix a deadlock (#17891)
This commit is contained in:
parent
97a5ff616b
commit
4cb240981e
1 changed files with 12 additions and 0 deletions
12
node/node.go
12
node/node.go
|
|
@ -569,11 +569,23 @@ func (n *Node) IPCEndpoint() string {
|
||||||
|
|
||||||
// HTTPEndpoint retrieves the current HTTP endpoint used by the protocol stack.
|
// HTTPEndpoint retrieves the current HTTP endpoint used by the protocol stack.
|
||||||
func (n *Node) HTTPEndpoint() string {
|
func (n *Node) HTTPEndpoint() string {
|
||||||
|
n.lock.Lock()
|
||||||
|
defer n.lock.Unlock()
|
||||||
|
|
||||||
|
if n.httpListener != nil {
|
||||||
|
return n.httpListener.Addr().String()
|
||||||
|
}
|
||||||
return n.httpEndpoint
|
return n.httpEndpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
// WSEndpoint retrieves the current WS endpoint used by the protocol stack.
|
// WSEndpoint retrieves the current WS endpoint used by the protocol stack.
|
||||||
func (n *Node) WSEndpoint() string {
|
func (n *Node) WSEndpoint() string {
|
||||||
|
n.lock.Lock()
|
||||||
|
defer n.lock.Unlock()
|
||||||
|
|
||||||
|
if n.wsListener != nil {
|
||||||
|
return n.wsListener.Addr().String()
|
||||||
|
}
|
||||||
return n.wsEndpoint
|
return n.wsEndpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue