Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement correct interested behaviour #1061

Merged
merged 2 commits into from Jul 25, 2018
Merged

Conversation

@bradleyjkemp
Copy link
Contributor

bradleyjkemp commented Feb 25, 2017

Start peers as uninterested and only move to interested if/once they have a piece that we need

Fixes #1059

…have a piece that we need
if (self._amInterested) wire.interested()
var interested = false
for (var index = 0; index < self.pieces.length; ++index) {
if (self.pieces[index] && wire.peerPieces.get(index)) {

This comment has been minimized.

Copy link
@DiegoRBaquero

DiegoRBaquero May 24, 2017

Member

Shouldn't this !self.pieces[index]? Indicating that we don't yet have that piece?

This comment has been minimized.

Copy link
@KayleePop

KayleePop May 16, 2018

Contributor

self.pieces[index] is deleted when that piece is downloaded and verified, so self.pieces[index] would be truthy when the piece still needs to be downloaded. The actual piece data is in the store. self.pieces[] is used to facilitate downloading.

!self.bitfield.get(index) is clearer.

@stale stale bot added the stale label May 3, 2018
@webtorrent webtorrent deleted a comment from stale bot May 3, 2018
@stale stale bot removed the stale label May 3, 2018
Copy link
Member

DiegoRBaquero left a comment

LGTM

@DiegoRBaquero DiegoRBaquero merged commit d37d6a7 into webtorrent:master Jul 25, 2018
3 checks passed
3 checks passed
Node Security No known vulnerabilities found
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@welcome

This comment has been minimized.

Copy link

welcome bot commented Jul 25, 2018

🎉 Congrats on getting your first pull request landed!

@lock lock bot locked as resolved and limited conversation to collaborators Oct 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.