mirror of https://github.com/vacp2p/nim-libp2p.git
don't forget closing the stream when final `{Fin}` fails in yamux (#1043)
This commit is contained in:
parent
d43c5feab0
commit
0b753e7cf2
|
@ -199,8 +199,9 @@ method closeImpl*(channel: YamuxChannel) {.async.} =
|
||||||
channel.closedLocally = true
|
channel.closedLocally = true
|
||||||
channel.isEof = true
|
channel.isEof = true
|
||||||
|
|
||||||
if channel.isReset == false and channel.sendQueue.len == 0:
|
if not channel.isReset and channel.sendQueue.len == 0:
|
||||||
await channel.conn.write(YamuxHeader.data(channel.id, 0, {Fin}))
|
try: await channel.conn.write(YamuxHeader.data(channel.id, 0, {Fin}))
|
||||||
|
except CancelledError, LPStreamError: discard
|
||||||
await channel.actuallyClose()
|
await channel.actuallyClose()
|
||||||
|
|
||||||
proc reset(channel: YamuxChannel, isLocal: bool = false) {.async.} =
|
proc reset(channel: YamuxChannel, isLocal: bool = false) {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue