mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 10:31:36 +00:00
parent
71c5cf5fb6
commit
1338282cc9
@ -19,8 +19,6 @@ Swarm.prototype.announce = function (params, cb) {
|
||||
if (self[fn]) {
|
||||
self[fn](params, peer) // process event
|
||||
|
||||
if (params.left === 0 && peer) peer.complete = true
|
||||
|
||||
cb(null, {
|
||||
complete: self.complete,
|
||||
incomplete: self.incomplete,
|
||||
@ -86,6 +84,12 @@ Swarm.prototype._onAnnounce_update = function (params, peer) {
|
||||
debug('unexpected `update` event from peer that is not in swarm')
|
||||
return this._onAnnounce_started(params, peer) // treat as a start
|
||||
}
|
||||
|
||||
if (!peer.complete && params.left === 0) {
|
||||
this.complete += 1
|
||||
this.incomplete -= 1
|
||||
peer.complete = true
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: randomize the peers that are given out
|
||||
|
Loading…
Reference in New Issue
Block a user