mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-02-17 07:17:00 +00:00
tests fixing
This commit is contained in:
parent
543ebdbdf5
commit
ef410509e6
@ -159,17 +159,22 @@ proc addHandler*[T: LPProtocol](m: MultistreamSelect,
|
|||||||
codecs: seq[string],
|
codecs: seq[string],
|
||||||
protocol: T,
|
protocol: T,
|
||||||
matcher: Matcher = nil) =
|
matcher: Matcher = nil) =
|
||||||
trace "registering protocol", protos = codecs
|
# trace "registering protocol", protos = codecs
|
||||||
m.handlers.add(HandlerHolder(protos: codecs,
|
m.handlers.add(HandlerHolder(protos: codecs,
|
||||||
protocol: protocol,
|
protocol: protocol,
|
||||||
match: matcher))
|
match: matcher))
|
||||||
|
|
||||||
|
proc addHandler*[T: LPProtocol](m: MultistreamSelect,
|
||||||
|
codec: string,
|
||||||
|
protocol: T,
|
||||||
|
matcher: Matcher = nil) =
|
||||||
|
addHandler(m, @[codec], protocol, matcher)
|
||||||
|
|
||||||
proc addHandler*[T: LPProtoHandler](m: MultistreamSelect,
|
proc addHandler*[T: LPProtoHandler](m: MultistreamSelect,
|
||||||
codec: string,
|
codec: string,
|
||||||
handler: T,
|
handler: T,
|
||||||
matcher: Matcher = nil) =
|
matcher: Matcher = nil) =
|
||||||
## helper to allow registering pure handlers
|
## helper to allow registering pure handlers
|
||||||
|
|
||||||
trace "registering proto handler", proto = codec
|
trace "registering proto handler", proto = codec
|
||||||
let protocol = new LPProtocol
|
let protocol = new LPProtocol
|
||||||
protocol.codec = codec
|
protocol.codec = codec
|
||||||
|
@ -580,7 +580,7 @@ proc maintainPeers(s: Switch) {.async.} =
|
|||||||
var conns = s.connections.getOrDefault(peer.id)
|
var conns = s.connections.getOrDefault(peer.id)
|
||||||
if conns.len == 0:
|
if conns.len == 0:
|
||||||
# attempt re-connect in this case
|
# attempt re-connect in this case
|
||||||
trace "explicit peering, trying to re-connect", peer
|
trace "explicit peering, trying to re-connect", peer = peer.id
|
||||||
await s.connect(peer)
|
await s.connect(peer)
|
||||||
|
|
||||||
s.maintainSleepFut = sleepAsync(5.minutes) # spec recommended
|
s.maintainSleepFut = sleepAsync(5.minutes) # spec recommended
|
||||||
|
Loading…
x
Reference in New Issue
Block a user