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

Switch to the new peer notify mechanism #564

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

Stebalien
Copy link
Member

  1. Only listen for peers added and identify events.
  2. Remove the old "Limited" check. Peers only show up as "Connected" if they have non-limited connections.
  3. Don't bother listening for new connections directly and/or connectivity changes. We'll get a new identify event per new connection regardless.

fixes #546

Comment on lines +13 to +14
// We don't bother subscribing to "connectivity" events because we always run identify after
// every new connection.
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is right but I'm not 100% certain. I remember remember running into some issues with this with respect to bitswap...

cc @sukunrt do you think the code here is sufficient?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this looks fine. We run identify after connecting on every connection.

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

Looks reasonable.
In fact, I am quite happy we got rid of that ancient notify code!

@Stebalien
Copy link
Member Author

Apparently pubsub uses the "blank" host in tests, which doesn't support identify.

@Stebalien
Copy link
Member Author

Tests should be fixed by #565.

1. Only listen for peers added and identify events.
2. Remove the old "Limited" check. Peers only show up as "Connected" if
they have non-limited connections.
3. Don't bother listening for new connections directly and/or
connectivity changes. We'll get a new identify event per new connection
regardless.

fixes #546
@Stebalien Stebalien force-pushed the steb/new-peer-notify-mechanism branch from 0b97df5 to 03f77e0 Compare July 11, 2024 10:37
@Stebalien
Copy link
Member Author

This conflicts with #440. I'd prefer to just remove that feature because it doesn't work reliably with identify.

@vyzo
Copy link
Collaborator

vyzo commented Jul 11, 2024

I agree, but we should check with users of the feature.
If there is none, no problem.

If it is in use, we might have to make some changes; maybe have a user function to test instead of directly comparing with the router protocols?

@Stebalien
Copy link
Member Author

Hm. You're right, we have the function and can just use that.

This is actually kind of backwards (it tells us if the peer would be
able to open a stream for us, not if we could open a steram to the peer)
but it's good enough.
@Stebalien
Copy link
Member Author

Ok, it should all work correctly-ish now. Or, well, correct enough.

@Stebalien Stebalien merged commit b23b3ee into master Jul 11, 2024
4 checks passed
@Stebalien Stebalien deleted the steb/new-peer-notify-mechanism branch July 11, 2024 11:46
@jefft0 jefft0 mentioned this pull request Jul 11, 2024
1 task
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.

NewStream failure right after startup
3 participants