Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
swarm: decrement score for contributors that didn't send contain
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioribeiro committed Aug 27, 2014
1 parent e6190da commit 78a9374
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ class Swarm extends BaseObject {
if (this.satisfyCandidate === peer && this.currentResource === resource) {
this.externalCallbackSuccess(chunk, "p2p")
var successPeer = this.findPeer(this.satisfyCandidate)
this.incrementScore(_.union([successPeer], this.peersContainsResource))
var goodPeers = _.union([successPeer], this.peersContainsResource)
var badPeers = _.difference(this.contributors, goodPeers)
this.incrementScore(goodPeers)
this.decrementScore(badPeers)
this.rebootRoundVars()
} else {
log.warn("satisfy received for a wrong resource or satisfyCandidate")
Expand Down

0 comments on commit 78a9374

Please sign in to comment.