mirror of https://github.com/status-im/nim-eth.git
Quick fix for when removePeer gets called before dispatcher is initialized
This commit is contained in:
parent
7cdd31e982
commit
5d9239ef17
|
@ -1122,6 +1122,9 @@ proc removePeer(network: EthereumNode, peer: Peer) =
|
|||
if network.peerPool != nil and not peer.remote.isNil:
|
||||
network.peerPool.connectedNodes.del(peer.remote)
|
||||
|
||||
# Note: we need to do this check as disconnect (and thus removePeer)
|
||||
# currently can get called before the dispatcher is initialized.
|
||||
if not peer.dispatcher.isNil:
|
||||
for observer in network.peerPool.observers.values:
|
||||
if not observer.onPeerDisconnected.isNil:
|
||||
if observer.protocol.isNil or peer.supports(observer.protocol):
|
||||
|
|
Loading…
Reference in New Issue