diff options
author | KayleePop <34007889+KayleePop@users.noreply.github.com> | 2020-05-26 05:38:10 +0300 |
---|---|---|
committer | KayleePop <34007889+KayleePop@users.noreply.github.com> | 2020-05-26 05:38:10 +0300 |
commit | cf5a15e2da6e270fa251c8765eed6e05c2f85ecd (patch) | |
tree | c16e8812f49d20bc679f2131446e11c0ff9a1da2 | |
parent | a07188f87a4acb7f8b2338c3d41da1b57cb9878c (diff) |
update interest when a peer's bitfield changes
It happened eventually before this, but was delayed until the next piece finished downloading
-rw-r--r-- | lib/torrent.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 4ac71a0..6e98725 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1048,11 +1048,13 @@ class Torrent extends EventEmitter { wire.on('bitfield', () => { updateSeedStatus() this._update() + this._updateWireInterest(wire) }) wire.on('have', () => { updateSeedStatus() this._update() + this._updateWireInterest(wire) }) wire.once('interested', () => { @@ -1084,7 +1086,9 @@ class Torrent extends EventEmitter { }) wire.bitfield(this.bitfield) // always send bitfield (required) - this._updateWireInterest(wire) // set inital interest + + // initialize interest in case bitfield message was already received before above handler was registered + this._updateWireInterest(wire) // Send PORT message to peers that support DHT if (wire.peerExtensions.dht && this.client.dht && this.client.dht.listening) { |