tests fixing

This commit is contained in:
Giovanni Petrantoni 2020-07-15 15:53:19 +09:00
parent 543ebdbdf5
commit ef410509e6
2 changed files with 8 additions and 3 deletions

View File

@ -159,17 +159,22 @@ proc addHandler*[T: LPProtocol](m: MultistreamSelect,
codecs: seq[string],
protocol: T,
matcher: Matcher = nil) =
trace "registering protocol", protos = codecs
# trace "registering protocol", protos = codecs
m.handlers.add(HandlerHolder(protos: codecs,
protocol: protocol,
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,
codec: string,
handler: T,
matcher: Matcher = nil) =
## helper to allow registering pure handlers
trace "registering proto handler", proto = codec
let protocol = new LPProtocol
protocol.codec = codec

View File

@ -580,7 +580,7 @@ proc maintainPeers(s: Switch) {.async.} =
var conns = s.connections.getOrDefault(peer.id)
if conns.len == 0:
# 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)
s.maintainSleepFut = sleepAsync(5.minutes) # spec recommended