From f9ad113d11dbfdab3826cc8c7ad64978c8a29ad0 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Thu, 13 Feb 2020 02:45:58 -0500 Subject: [PATCH] don't send close message if remote closed --- libp2p/muxers/mplex/lpchannel.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libp2p/muxers/mplex/lpchannel.nim b/libp2p/muxers/mplex/lpchannel.nim index dfd83a614..bda141abf 100644 --- a/libp2p/muxers/mplex/lpchannel.nim +++ b/libp2p/muxers/mplex/lpchannel.nim @@ -62,7 +62,8 @@ proc newChannel*(id: uint, result.initBufferStream(writeHandler, size) proc closeMessage(s: LPChannel) {.async.} = - await s.conn.writeMsg(s.id, s.closeCode) # write header + if not s.closed: + await s.conn.writeMsg(s.id, s.closeCode) # write header proc closedByRemote*(s: LPChannel) {.async.} = s.closedRemote = true