From 63e1872516cdbd2c843e5297aa36616a531ac2cd Mon Sep 17 00:00:00 2001 From: Tanguy Date: Fri, 16 Dec 2022 18:14:40 +0100 Subject: [PATCH] Fix yamux simultaneous closing (#823) --- libp2p/muxers/yamux/yamux.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libp2p/muxers/yamux/yamux.nim b/libp2p/muxers/yamux/yamux.nim index a5273794d..9f28449c6 100644 --- a/libp2p/muxers/yamux/yamux.nim +++ b/libp2p/muxers/yamux/yamux.nim @@ -414,7 +414,8 @@ method close*(m: Yamux) {.async.} = let channels = toSeq(m.channels.values()) for channel in channels: await channel.reset(true) - await m.connection.write(YamuxHeader.goAway(NormalTermination)) + try: await m.connection.write(YamuxHeader.goAway(NormalTermination)) + except CatchableError as exc: trace "failed to send goAway", msg=exc.msg await m.connection.close() trace "Closed yamux"