add missing test
This commit is contained in:
parent
9b20dbc7ae
commit
6ce2782e5c
|
@ -68,9 +68,9 @@ proc reset*(s: Channel) {.async.} =
|
||||||
await allFutures(s.resetMessage(), s.remoteReset())
|
await allFutures(s.resetMessage(), s.remoteReset())
|
||||||
|
|
||||||
proc isReadEof(s: Channel): bool =
|
proc isReadEof(s: Channel): bool =
|
||||||
bool((s.closedRemote or s.closedLocal) and s.len() <= 0)
|
bool((s.closedRemote or s.closedLocal) and s.len() < 1)
|
||||||
|
|
||||||
method pushTo*(s: Channel, data: seq[byte]): Future[void] {.gcsafe.} =
|
proc pushTo*(s: Channel, data: seq[byte]): Future[void] {.gcsafe.} =
|
||||||
if s.closedRemote:
|
if s.closedRemote:
|
||||||
raise newLPStreamClosedError()
|
raise newLPStreamClosedError()
|
||||||
result = procCall pushTo(BufferStream(s), data)
|
result = procCall pushTo(BufferStream(s), data)
|
||||||
|
|
|
@ -178,3 +178,12 @@ suite "Mplex":
|
||||||
|
|
||||||
expect LPStreamClosedError:
|
expect LPStreamClosedError:
|
||||||
waitFor(testResetWrite())
|
waitFor(testResetWrite())
|
||||||
|
|
||||||
|
test "should not allow pushing data to channel when remote end closed":
|
||||||
|
proc testResetWrite(): Future[void] {.async.} =
|
||||||
|
let chann = newChannel(1, newConnection(new LPStream), true)
|
||||||
|
await chann.closeRemote()
|
||||||
|
await chann.pushTo(@[byte(1)])
|
||||||
|
|
||||||
|
expect LPStreamClosedError:
|
||||||
|
waitFor(testResetWrite())
|
||||||
|
|
Loading…
Reference in New Issue