Fix freezes in connection initialization.
This commit is contained in:
parent
60fdde6368
commit
5742299c94
|
@ -188,7 +188,10 @@ proc dialPeer*(node: Eth2Node, peerInfo: PeerInfo) {.async.} =
|
|||
discard await node.switch.dial(peerInfo)
|
||||
var peer = node.getPeer(peerInfo)
|
||||
peer.wasDialed = true
|
||||
debug "Initializing connection"
|
||||
await initializeConnection(peer)
|
||||
debug "Subscribing to pubsub"
|
||||
await peer.network.switch.subscribeToPeer(peer.info)
|
||||
inc libp2p_successful_dials
|
||||
debug "Network handshakes completed"
|
||||
|
||||
|
@ -201,6 +204,7 @@ proc runDiscoveryLoop*(node: Eth2Node) {.async.} =
|
|||
if currentPeerCount < node.wantedPeers:
|
||||
try:
|
||||
let discoveredPeers = await node.discovery.lookupRandom()
|
||||
debug "Discovered peers", peer = $discoveredPeers
|
||||
for peer in discoveredPeers:
|
||||
debug "Discovered peer", peer = $peer
|
||||
try:
|
||||
|
|
|
@ -163,7 +163,7 @@ proc handleInitialStatus(peer: Peer,
|
|||
# will allow us to implement the subscription earlier.
|
||||
# The root of the problem is that both sides must call `subscribeToPeer`
|
||||
# before any GossipSub traffic will flow between them.
|
||||
await peer.network.switch.subscribeToPeer(peer.info)
|
||||
discard
|
||||
|
||||
if theirStatus.forkVersion != state.forkVersion:
|
||||
notice "Irrelevant peer",
|
||||
|
|
Loading…
Reference in New Issue