-
Notifications
You must be signed in to change notification settings - Fork 193
Only sessions on main state are active #711
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
base: main
Are you sure you want to change the base?
Changes from all commits
604c744
4869ad2
7da0111
d41997c
b3a8ad1
41d3594
f64fb11
5e10668
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1541,7 +1541,7 @@ module.exports = class Replicator { | |
| clearTimeout(this._downloadingTimer) | ||
|
|
||
| if (this.destroyed) return | ||
| if (downloading || this._notDownloadingLinger === 0) { | ||
| if (downloading || this._notDownloadingLinger === 0 || !this.peers.length) { | ||
| this.setDownloadingNow(downloading) | ||
| return | ||
| } | ||
|
|
@@ -2461,6 +2461,8 @@ module.exports = class Replicator { | |
| } | ||
|
|
||
| _makePeer (protomux) { | ||
| if (!this.downloading) return false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs some thought, because I think it could be dangerous. Doesn't this mean we will never open replication sessions to peers if we're not downloading the hypercore ourselves? So the underlying assumption is: we always have For example, this assumes there's no path where we open a connection to a peer while (not saying this isn't correct, it just rings some alarm bells of 'potentially dangerous'. The fact that all tests pass does seem like a good sign)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ya true, we should add a test that checks if an inactive peer can replicate with an active peer if we dont |
||
|
|
||
| const replicator = this | ||
| if (protomux.opened({ protocol: 'hypercore/alpha', id: this.core.discoveryKey })) return onnochannel() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanity check: isn't the point of having
this._notDownloadingLingerthat we postpone switching off the downloading a bit? We seem to override that check whenthis.peers.length === 0