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