From ef410509e68ca2bece3baefae344eb892ae83fd8 Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni Date: Wed, 15 Jul 2020 15:53:19 +0900 Subject: [PATCH] tests fixing --- libp2p/multistream.nim | 9 +++++++-- libp2p/switch.nim | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libp2p/multistream.nim b/libp2p/multistream.nim index 12a008fd7..7669a4a7a 100644 --- a/libp2p/multistream.nim +++ b/libp2p/multistream.nim @@ -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 diff --git a/libp2p/switch.nim b/libp2p/switch.nim index 9c2a8db2d..faba9a1f7 100644 --- a/libp2p/switch.nim +++ b/libp2p/switch.nim @@ -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