From 152c1e3c14ba03e501e21fb2b079e6f0f8c7c7ab Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Sat, 31 Aug 2019 11:58:08 -0600 Subject: [PATCH] close connections asyncronously --- libp2p/transport.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/transport.nim b/libp2p/transport.nim index 6b40a47..954fe45 100644 --- a/libp2p/transport.nim +++ b/libp2p/transport.nim @@ -7,6 +7,7 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. +import sequtils import chronos import peerinfo, connection, multiaddress, multicodec @@ -34,8 +35,7 @@ proc newTransport*(t: typedesc[Transport]): t {.gcsafe.} = method close*(t: Transport) {.base, async, gcsafe.} = ## stop and cleanup the transport ## including all outstanding connections - for c in t.connections: - await c.connection.close() + await allFutures(t.connections.mapIt(it.connection.close())) method listen*(t: Transport, ma: MultiAddress,