From f60226159548f3f122743d9c1fe3951b93fe9b96 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 8 Jan 2016 03:28:05 +0100 Subject: test: blocklist-dht wait wait for both conditions before going on --- test/node/blocklist-dht.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test/node') diff --git a/test/node/blocklist-dht.js b/test/node/blocklist-dht.js index 5de3f8c..474d5c3 100644 --- a/test/node/blocklist-dht.js +++ b/test/node/blocklist-dht.js @@ -67,16 +67,24 @@ test('blocklist blocks peers discovered via DHT', function (t) { torrent2.on('blockedPeer', function (addr) { t.pass('client2 blocked connection to client1: ' + addr) + blockedPeer = true + maybeDone() }) torrent2.on('dhtAnnounce', function () { t.pass('client2 announced to dht') - cb(null) + announced = true + maybeDone() }) torrent2.on('peer', function (addr) { t.fail('client2 should not find any peers') }) + + var blockedPeer, announced + function maybeDone () { + if (blockedPeer && announced) cb(null) + } } ], function (err) { -- cgit v1.2.3