We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71c5cf5 commit 1338282Copy full SHA for 1338282
lib/swarm.js
@@ -19,8 +19,6 @@ Swarm.prototype.announce = function (params, cb) {
19
if (self[fn]) {
20
self[fn](params, peer) // process event
21
22
- if (params.left === 0 && peer) peer.complete = true
23
-
24
cb(null, {
25
complete: self.complete,
26
incomplete: self.incomplete,
@@ -86,6 +84,12 @@ Swarm.prototype._onAnnounce_update = function (params, peer) {
86
84
debug('unexpected `update` event from peer that is not in swarm')
87
85
return this._onAnnounce_started(params, peer) // treat as a start
88
}
+
+ if (!peer.complete && params.left === 0) {
89
+ this.complete += 1
90
+ this.incomplete -= 1
91
+ peer.complete = true
92
+ }
93
94
95
// TODO: randomize the peers that are given out
0 commit comments