don't complete futures twise
This commit is contained in:
parent
e8287a0e82
commit
2febd47e0d
|
@ -75,7 +75,7 @@ method handle*(m: Mplex) {.async, gcsafe.} =
|
||||||
of MessageType.New:
|
of MessageType.New:
|
||||||
let name = cast[string](data)
|
let name = cast[string](data)
|
||||||
channel = await m.newStreamInternal(false, id, name)
|
channel = await m.newStreamInternal(false, id, name)
|
||||||
# debug "handle: created channel ", id = id, name = name
|
debug "handle: created channel ", id = id, name = name
|
||||||
if not isNil(m.streamHandler):
|
if not isNil(m.streamHandler):
|
||||||
let handlerFut = m.streamHandler(newConnection(channel))
|
let handlerFut = m.streamHandler(newConnection(channel))
|
||||||
|
|
||||||
|
|
|
@ -250,8 +250,6 @@ suite "Mplex":
|
||||||
await stream.close()
|
await stream.close()
|
||||||
|
|
||||||
await conn.close()
|
await conn.close()
|
||||||
listenFut.complete()
|
|
||||||
dialFut.complete()
|
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
check:
|
check:
|
||||||
|
|
|
@ -64,7 +64,6 @@ suite "Switch":
|
||||||
(switch2, peerInfo2) = createSwitch(ma2)
|
(switch2, peerInfo2) = createSwitch(ma2)
|
||||||
await switch2.start()
|
await switch2.start()
|
||||||
let conn = await switch2.dial(peerInfo1, TestCodec)
|
let conn = await switch2.dial(peerInfo1, TestCodec)
|
||||||
debug "TEST SWITCH: dial succesful"
|
|
||||||
await conn.writeLp("Hello!")
|
await conn.writeLp("Hello!")
|
||||||
let msg = cast[string](await conn.readLp())
|
let msg = cast[string](await conn.readLp())
|
||||||
check "Hello!" == msg
|
check "Hello!" == msg
|
||||||
|
|
Loading…
Reference in New Issue