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

Don't start downloading when core is not active #477

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

HDegroote
Copy link
Contributor

Current behaviour doesn't interact well with corestore, because whenever a peer connects on a discovery key with you, this line is called:
https://github.com/holepunchto/corestore/blob/3ab2595c8313179bc98567dbe28389245ddca6e8/index.js#L345

Even though active: false is passed in when creating the core, when this.downloading is true (which it always is initially) you still end up requesting a download from all the other peers you're connected with on that core, and they end up doing the same, so it propagates.

Note: I'm not sure why this.downloading had default true. This is a big behaviour change, so might break something. Fwiw, tests also pass when it's defaulted to false.

@HDegroote
Copy link
Contributor Author

See holepunchto/corestore#86 for a corestore test illustrating the current behaviour. That test passes when using this PR

Copy link
Contributor Author

@HDegroote HDegroote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@mafintosh mafintosh merged commit d8febb9 into main Jan 26, 2024
4 checks passed
@mafintosh mafintosh deleted the no-init-downloading-when-inactive branch January 26, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants