don't crash schlesi-dev

This commit is contained in:
Dmitriy Ryajov 2020-05-23 11:15:47 -06:00
parent 20c68a2018
commit daef00fc7b
2 changed files with 9 additions and 9 deletions

View File

@ -79,7 +79,7 @@ proc handle*(p: PubSubPeer, conn: Connection) {.async.} =
proc send*(p: PubSubPeer, msgs: seq[RPCMsg]) {.async.} =
for m in msgs.items:
trace "sending msgs to peer", toPeer = p.id, msgs = msgs
trace "sending msgs to peer", toPeer = p.id, msgs = $msgs
let encoded = encodeRpcMsg(m)
# trigger hooks
if not(isNil(p.observers)) and p.observers[].len > 0:

View File

@ -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
@ -167,10 +164,14 @@ proc testPubSubNodePublish(gossip: bool = false,
await daemonNode.close()
suite "Interop":
teardown:
for tracker in testTrackers():
echo tracker.dump()
# check tracker.isLeaked() == false
# TODO: chronos transports are leaking,
# but those are tracked for both the daemon
# and libp2p, so not sure which one it is,
# need to investigate more
# teardown:
# for tracker in testTrackers():
# # echo tracker.dump()
# # check tracker.isLeaked() == false
test "native -> daemon multiple reads and writes":
proc runTests(): Future[bool] {.async.} =
@ -352,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()