fix: multistream tests

This commit is contained in:
Dmitriy Ryajov 2019-09-08 01:59:14 -06:00
parent e31966b6f8
commit 93a9fd203a
3 changed files with 8 additions and 5 deletions

View File

@ -8,12 +8,12 @@
## those terms. ## those terms.
import chronos, strformat import chronos, strformat
import ../../stream/bufferstream, import types,
coder,
nimcrypto/utils,
../../stream/bufferstream,
../../stream/lpstream, ../../stream/lpstream,
../../connection, ../../connection,
nimcrypto/utils,
types,
coder,
../../helpers/debug ../../helpers/debug
const DefaultChannelSize* = DefaultBufferSize * 64 # 64kb const DefaultChannelSize* = DefaultBufferSize * 64 # 64kb

View File

@ -117,8 +117,8 @@ proc handleConn(s: Switch, conn: Connection): Future[Connection] {.async, gcsafe
await s.mux(result) # mux it if possible await s.mux(result) # mux it if possible
proc cleanupConn(s: Switch, conn: Connection) {.async, gcsafe.} = proc cleanupConn(s: Switch, conn: Connection) {.async, gcsafe.} =
let id = if conn.peerInfo.isSome: conn.peerInfo.get().peerId.pretty else: ""
if conn.peerInfo.isSome: if conn.peerInfo.isSome:
let id = conn.peerInfo.get().peerId.pretty
if s.muxed.contains(id): if s.muxed.contains(id):
await s.muxed[id].close await s.muxed[id].close

View File

@ -43,6 +43,9 @@ method readExactly*(s: TestSelectStream,
cstring("\0x3na\n"), cstring("\0x3na\n"),
"\0x3na\n".len()) "\0x3na\n".len())
method write*(s: TestSelectStream, msg: seq[byte], msglen = -1)
{.async, gcsafe.} = discard
method write*(s: TestSelectStream, msg: string, msglen = -1) method write*(s: TestSelectStream, msg: string, msglen = -1)
{.async, gcsafe.} = discard {.async, gcsafe.} = discard