-
Notifications
You must be signed in to change notification settings - Fork 184
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
refactor(iroh-net): Improve API to retrieve local endpoints #2041
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The API to retrieve local endpoints was split in two between the current endpoints and updates to it. This was very hard to use right without any race conditions. This replaces it with a single API which returns a stream. This is a little bit wordier to use if you just need the current local item, but much harder to misuse.
dignifiedquire
approved these changes
Feb 22, 2024
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.
thank you for improving this horrible api!
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Feb 22, 2024
3 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 22, 2024
## Description This incorporates two fixes: - The .set_preferred_port() function was completely ignoring the passed port. This is now plugged through to the rebind. Nobody was using this function before though. I'm not so sure how useful it is. - When rebinding the locally bound sockets change. This means we have to do a new netcheck as otherwise we won't know about our new endpoints until a new netcheck runs on it's regular schedule. ## Notes & open questions This is kind of split off from #2041 because it ends up doing unrelated fixes just for an improvement to tests. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
fubuloubu
pushed a commit
to ApeWorX/iroh
that referenced
this pull request
Feb 27, 2024
…ter#2041) ## Description The API to retrieve local endpoints was split in two between the current endpoints and updates to it. This was very hard to use right without any race conditions. This replaces it with a single API which returns a stream. This is a little bit wordier to use if you just need the current local item, but much harder to misuse. ## Notes & open questions It would be possible to add a convenient `.current_local_endpoints()` API if we wanted. Not sure this is really worth it. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
fubuloubu
pushed a commit
to ApeWorX/iroh
that referenced
this pull request
Feb 27, 2024
## Description This incorporates two fixes: - The .set_preferred_port() function was completely ignoring the passed port. This is now plugged through to the rebind. Nobody was using this function before though. I'm not so sure how useful it is. - When rebinding the locally bound sockets change. This means we have to do a new netcheck as otherwise we won't know about our new endpoints until a new netcheck runs on it's regular schedule. ## Notes & open questions This is kind of split off from n0-computer#2041 because it ends up doing unrelated fixes just for an improvement to tests. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The API to retrieve local endpoints was split in two between the
current endpoints and updates to it. This was very hard to use right
without any race conditions.
This replaces it with a single API which returns a stream. This is a
little bit wordier to use if you just need the current local item, but
much harder to misuse.
Notes & open questions
It would be possible to add a convenient
.current_local_endpoints()
API if we wanted. Not sure this is really worth it.
Change checklist