don't send close message if remote closed

This commit is contained in:
Dmitriy Ryajov 2020-02-13 02:45:58 -05:00
parent f6c4d2130a
commit f9ad113d11
1 changed files with 2 additions and 1 deletions

View File

@ -62,6 +62,7 @@ proc newChannel*(id: uint,
result.initBufferStream(writeHandler, size) result.initBufferStream(writeHandler, size)
proc closeMessage(s: LPChannel) {.async.} = proc closeMessage(s: LPChannel) {.async.} =
if not s.closed:
await s.conn.writeMsg(s.id, s.closeCode) # write header await s.conn.writeMsg(s.id, s.closeCode) # write header
proc closedByRemote*(s: LPChannel) {.async.} = proc closedByRemote*(s: LPChannel) {.async.} =