mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-02-17 23:36:34 +00:00
emulate defered
This commit is contained in:
parent
2ecc699b6e
commit
a73bc40ae4
@ -66,6 +66,7 @@ proc newStreamInternal*(m: Mplex,
|
||||
|
||||
method handle*(m: Mplex) {.async, gcsafe.} =
|
||||
trace "starting mplex main loop", oid = m.oid
|
||||
try:
|
||||
try:
|
||||
while not m.connection.closed:
|
||||
trace "waiting for data", oid = m.oid
|
||||
@ -157,11 +158,11 @@ method handle*(m: Mplex) {.async, gcsafe.} =
|
||||
channoid = channel.oid,
|
||||
oid = m.oid
|
||||
break
|
||||
except CatchableError as exc:
|
||||
trace "Exception occurred", exception = exc.msg, oid = m.oid
|
||||
finally:
|
||||
trace "stopping mplex main loop", oid = m.oid
|
||||
await m.close()
|
||||
except CatchableError as exc:
|
||||
trace "Exception occurred", exception = exc.msg, oid = m.oid
|
||||
|
||||
proc newMplex*(conn: Connection,
|
||||
maxChanns: uint = MaxChannels): Mplex =
|
||||
|
@ -83,7 +83,6 @@ proc testPubSubDaemonPublish(gossip: bool = false,
|
||||
let smsg = cast[string](data)
|
||||
check smsg == pubsubData
|
||||
times.inc()
|
||||
echo "TIMES ", times
|
||||
if times >= count and not finished:
|
||||
finished = true
|
||||
|
||||
@ -108,7 +107,6 @@ proc testPubSubDaemonPublish(gossip: bool = false,
|
||||
|
||||
await wait(publisher(), 5.minutes) # should be plenty of time
|
||||
|
||||
echo "HEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
result = true
|
||||
await nativeNode.stop()
|
||||
await allFutures(awaiters)
|
||||
@ -144,7 +142,6 @@ proc testPubSubNodePublish(gossip: bool = false,
|
||||
let smsg = cast[string](message.data)
|
||||
check smsg == pubsubData
|
||||
times.inc()
|
||||
echo "TIMES ", times
|
||||
if times >= count and not finished:
|
||||
finished = true
|
||||
result = true # don't cancel subscription
|
||||
@ -356,7 +353,6 @@ suite "Interop":
|
||||
check line == test
|
||||
await conn.writeLp(cast[seq[byte]](test))
|
||||
count.inc()
|
||||
echo "COUNT ", count
|
||||
|
||||
testFuture.complete(count)
|
||||
await conn.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user