mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
Merge branch 'peerinfo' into devel
This commit is contained in:
commit
e37c12b810
@ -663,13 +663,16 @@ proc runDiscoveryLoop*(node: Eth2Node) {.async.} =
|
|||||||
try:
|
try:
|
||||||
let discoveredPeers =
|
let discoveredPeers =
|
||||||
node.discovery.randomNodes(node.wantedPeers - currentPeerCount)
|
node.discovery.randomNodes(node.wantedPeers - currentPeerCount)
|
||||||
debug "Discovered peers", peer = $discoveredPeers
|
|
||||||
for peer in discoveredPeers:
|
for peer in discoveredPeers:
|
||||||
try:
|
try:
|
||||||
let peerInfo = peer.record.toTypedRecord.toPeerInfo
|
let peerInfo = peer.record.toTypedRecord.toPeerInfo
|
||||||
if peerInfo != nil and peerInfo.id notin node.switch.connections:
|
if peerInfo != nil:
|
||||||
|
if peerInfo.id notin node.switch.connections:
|
||||||
|
debug "Discovered new peer", peer = $peer
|
||||||
# TODO do this in parallel
|
# TODO do this in parallel
|
||||||
await node.dialPeer(peerInfo)
|
await node.dialPeer(peerInfo)
|
||||||
|
else:
|
||||||
|
peerInfo.close()
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
debug "Failed to connect to peer", peer = $peer, err = err.msg
|
debug "Failed to connect to peer", peer = $peer, err = err.msg
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user