working out synchronization issues

This commit is contained in:
Dmitriy Ryajov 2020-02-13 10:19:26 -05:00
parent b1dd564c32
commit acdaeb8f5d
2 changed files with 2 additions and 3 deletions

View File

@ -62,8 +62,7 @@ proc newChannel*(id: uint,
result.initBufferStream(writeHandler, size) result.initBufferStream(writeHandler, size)
proc closeMessage(s: LPChannel) {.async.} = proc closeMessage(s: LPChannel) {.async.} =
if not s.closed: await s.conn.writeMsg(s.id, s.closeCode) # write header
await s.conn.writeMsg(s.id, s.closeCode) # write header
proc closedByRemote*(s: LPChannel) {.async.} = proc closedByRemote*(s: LPChannel) {.async.} =
s.closedRemote = true s.closedRemote = true

View File

@ -223,7 +223,7 @@ suite "FloodSub":
await node.publish("foobar", cast[seq[byte]]("Hello!")) await node.publish("foobar", cast[seq[byte]]("Hello!"))
await sleepAsync(100.millis) await sleepAsync(100.millis)
await sleepAsync(1.minutes) await sleepAsync(5000.millis)
await allFutures(nodes.mapIt(it.stop())) await allFutures(nodes.mapIt(it.stop()))
await allFutures(awaitters) await allFutures(awaitters)