mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-15 17:35:45 +00:00
fix: peer manager dial logic when dialing an existing peer (#1090)
This commit is contained in:
parent
45f6216aaa
commit
caa47896c1
@ -48,7 +48,7 @@ proc insertOrReplace(ps: PeerStorage,
|
|||||||
proc dialPeer(pm: PeerManager, peerId: PeerID,
|
proc dialPeer(pm: PeerManager, peerId: PeerID,
|
||||||
addrs: seq[MultiAddress], proto: string,
|
addrs: seq[MultiAddress], proto: string,
|
||||||
dialTimeout = defaultDialTimeout): Future[Option[Connection]] {.async.} =
|
dialTimeout = defaultDialTimeout): Future[Option[Connection]] {.async.} =
|
||||||
info "Dialing peer from manager", wireAddr = addrs[0], peerId = peerId
|
info "Dialing peer from manager", wireAddr = addrs, peerId = peerId
|
||||||
|
|
||||||
# Dial Peer
|
# Dial Peer
|
||||||
let dialFut = pm.switch.dial(peerId, addrs, proto)
|
let dialFut = pm.switch.dial(peerId, addrs, proto)
|
||||||
@ -290,7 +290,5 @@ proc dialPeer*(pm: PeerManager, peerId: PeerID, proto: string, dialTimeout = def
|
|||||||
return none(Connection)
|
return none(Connection)
|
||||||
|
|
||||||
let addrs = pm.switch.peerStore[AddressBook][peerId]
|
let addrs = pm.switch.peerStore[AddressBook][peerId]
|
||||||
if addrs.len == 0:
|
|
||||||
return none(Connection)
|
|
||||||
|
|
||||||
return await pm.dialPeer(peerId, addrs, proto, dialTimeout)
|
return await pm.dialPeer(peerId, addrs, proto, dialTimeout)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user