Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/node/blocklist-dht.js')
-rw-r--r--test/node/blocklist-dht.js10
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) {