diff --git a/libp2p/protocols/pubsub/gossipsub.nim b/libp2p/protocols/pubsub/gossipsub.nim index a82769b7a..a63668347 100644 --- a/libp2p/protocols/pubsub/gossipsub.nim +++ b/libp2p/protocols/pubsub/gossipsub.nim @@ -413,8 +413,9 @@ method start*(g: GossipSub) {.async.} = # setup the heartbeat interval g.heartbeatCancel = addInterval(GossipSubHeartbeatInterval, - proc (arg: pointer = nil) {.gcsafe, locks: 0.} = - asyncCheck g.heartbeat) + proc (arg: pointer = nil) + {.gcsafe, locks: 0.} = + asyncCheck g.heartbeat) method stop*(g: GossipSub) {.async.} = ## stopt pubsub diff --git a/libp2p/stream/bufferstream.nim b/libp2p/stream/bufferstream.nim index f3f29e049..8b9933a37 100644 --- a/libp2p/stream/bufferstream.nim +++ b/libp2p/stream/bufferstream.nim @@ -107,11 +107,6 @@ proc pushTo*(s: BufferStream, data: seq[byte]) {.async.} = await s.lock.acquire() var index = 0 while true: - # give readers a chance free up the buffer - # it it's full. - if s.readBuf.len >= s.maxSize: - await sleepAsync(1.millis) - while index < data.len and s.readBuf.len < s.maxSize: s.readBuf.addLast(data[index]) inc(index) diff --git a/tests/pubsub/testfloodsub.nim b/tests/pubsub/testfloodsub.nim index f8389d7af..c66d94f94 100644 --- a/tests/pubsub/testfloodsub.nim +++ b/tests/pubsub/testfloodsub.nim @@ -190,7 +190,7 @@ suite "FloodSub": await node.publish("foobar", cast[seq[byte]]("Hello!")) await sleepAsync(100.millis) - await sleepAsync(5000.millis) + await sleepAsync(1.minutes) await allFutures(nodes.mapIt(it.stop())) await allFutures(awaitters) @@ -223,7 +223,7 @@ suite "FloodSub": await node.publish("foobar", cast[seq[byte]]("Hello!")) await sleepAsync(100.millis) - await sleepAsync(5000.millis) + await sleepAsync(1.minutes) await allFutures(nodes.mapIt(it.stop())) await allFutures(awaitters) diff --git a/tests/pubsub/testpubsub.nim b/tests/pubsub/testpubsub.nim index 1401b3168..94043dc11 100644 --- a/tests/pubsub/testpubsub.nim +++ b/tests/pubsub/testpubsub.nim @@ -1,4 +1,4 @@ include ../../libp2p/protocols/pubsub/gossipsub -import testfloodsub, - testgossipsub, +import testgossipsub, + testfloodsub, testmcache diff --git a/tests/testnative.nim b/tests/testnative.nim index d8790af6a..002619d04 100644 --- a/tests/testnative.nim +++ b/tests/testnative.nim @@ -2,13 +2,13 @@ import testvarint import testrsa, testecnist, tested25519, testsecp256k1, testcrypto import testmultibase, testmultihash, testmultiaddress, testcid, testpeer -import testtransport, - testmultistream, - testbufferstream, - testidentify, +import testtransport, + testmultistream, + testbufferstream, + testidentify, testswitch, testpeerinfo, pubsub/testpubsub, - # TODO: placing this before pubsub tests, + # TODO: placing this before pubsub tests, # breaks some flood and gossip tests - no idea why testmplex