From 833a5b8e5771fbf34a941dcedb1bcc116fca7cfa Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 17 Aug 2020 13:32:02 +0200 Subject: [PATCH] add muxer nil check --- libp2p/switch.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libp2p/switch.nim b/libp2p/switch.nim index dfb2e9f..23e1204 100644 --- a/libp2p/switch.nim +++ b/libp2p/switch.nim @@ -220,6 +220,10 @@ proc upgradeOutgoing(s: Switch, conn: Connection): Future[Connection] {.async, g trace "upgrading connection" let muxer = await s.mux(sconn) # mux it if possible + if muxer == nil: + # TODO this might be relaxed in the future + raise newException(CatchableError, + "a muxer is required for outgoing connections") await s.identify(muxer)