-
Notifications
You must be signed in to change notification settings - Fork 998
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(tcp): reducing branching in Transport::create_socket
#4328
Conversation
and add test for listening on ipv4 and ipv6 separately.
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 the follow-up.
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.
I suggest having the operating system choose any free port. In case someone has e.g. a go-ipfs node running on 4001
their unit tests would still succeed.
but that defeats the purpose of the test no? I.e. being certain that ipv4 and ipv6 run in the same port. I can try something else nonetheless. |
Ah, yes, sorry. My bad. How about a more random port than |
Transport::create_socket
You can use a TcpListener to first bind a random port, retrieve the port, drop the listener and then bind to it again :) |
to use dynamic port allocation as well.
yup exactly 😁. Meanwhile also updated the Quic test, if wanted I can move it instead do a new PR aha |
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.
Neat. Thank you. Fine to merge in one pull request.
@mxinden Why is the |
@mergify refresh |
✅ Pull request refreshed |
My bad. I changed it through the UI without thinking it all the way through. Thanks for catching. Sorry for the debugging time wasted on this. What do you think of running it on all changes, simply succeeding right away on non-Cargo.toml changes @thomaseizinger? I would like to get to a place where one does not have to manually check for non-required failures. |
I think we can simply add it to the CI workflow. I don't see why it shouldn't run on all code changes. It is slightly wasteful in terms of resource usage but I don't think it weighs in very heavily for the gained simplicity in the setup. |
Allows us to make `cargo-deny` job required. See original discussion libp2p#4328 (comment).
Sounds good. Let me know what you think of #4352. |
Allows us to make `cargo-deny` job required. See original discussion #4328 (comment). Pull-Request: #4352.
and add test for listening on ipv4 and ipv6 separately.
Description
Following #4289 (comment), hereby is the PR to also improve the
create_socket
usingfor_addr
. We also add a test for listening on IPv4 and IPv6 separately.Change checklist