mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-06-27 21:09:28 +00:00
Connect boostrap nodes concurrently
This commit is contained in:
parent
da1066c32a
commit
5b7ff05138
@ -126,8 +126,11 @@ proc start*(s: StorageServer) {.async.} =
|
||||
await s.storageNode.start()
|
||||
|
||||
# Connect to the bootstrap nodes in order to have connected peers
|
||||
# for Autonat.
|
||||
for spr in findReachableNodes(s.bootstrapNodes):
|
||||
# for Autonat. The dials are run concurrently in case of
|
||||
# a dead bootstrap node that could timeout.
|
||||
proc connectBootstrapNode(
|
||||
spr: SignedPeerRecord
|
||||
) {.async: (raises: [CancelledError]).} =
|
||||
try:
|
||||
let addrs = spr.data.addresses.mapIt(it.address)
|
||||
await s.storageNode.switch.connect(spr.data.peerId, addrs)
|
||||
@ -136,6 +139,8 @@ proc start*(s: StorageServer) {.async.} =
|
||||
except CatchableError as e:
|
||||
warn "Cannot connect to bootstrap node", error = e.msg
|
||||
|
||||
await allFutures(findReachableNodes(s.bootstrapNodes).mapIt(connectBootstrapNode(it)))
|
||||
|
||||
# Start AutoNAT here (we own it, it is not in switch.services) so its first
|
||||
# probe targets the now-connected bootstrap peers instead of firing at
|
||||
# switch.start on no peers.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user