diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-01-08 05:28:05 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-01-08 05:28:05 +0300 |
commit | f60226159548f3f122743d9c1fe3951b93fe9b96 (patch) | |
tree | c5ad6006d4b48ac73d34ab619100ba77a30f45cc /test | |
parent | 860fbc3c26f23e37643aecfb80cdbd582acbad78 (diff) |
test: blocklist-dht wait
wait for both conditions before going on
Diffstat (limited to 'test')
-rw-r--r-- | test/node/blocklist-dht.js | 10 |
1 files changed, 9 insertions, 1 deletions
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) { |