From 77e866d29a58ad6cfefaf9c8a8ee7159a43bcfe5 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 9 Dec 2019 19:17:29 +0200 Subject: [PATCH] Address review comments --- libp2p/switch.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/switch.nim b/libp2p/switch.nim index 3d4c3ce25..515d00796 100644 --- a/libp2p/switch.nim +++ b/libp2p/switch.nim @@ -199,7 +199,7 @@ proc dial*(s: Switch, let id = peer.id trace "Dialing peer", peer = id result = s.connections.getOrDefault(id) - if result == nil or result.closed: + if result.isNil or result.closed: for t in s.transports: # for each transport for a in peer.addrs: # for each address if t.handles(a): # check if it can dial it @@ -210,7 +210,7 @@ proc dial*(s: Switch, result = await s.upgradeOutgoing(result) result.closeEvent.wait().addCallback do (udata: pointer): asyncCheck s.cleanupConn(result) - break + break else: trace "Reusing existing connection"