-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat: implementing port 0 support #2125
Conversation
You can find the image built from this PR at
Built from b0fd5f0 |
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.
Beautiful PR! It looks nice so far!
I've added a few comments and I'll study it again once it becomes "ready".
fcd8c15
to
7a25d49
Compare
apps/wakunode2/app.nim
Outdated
let wsAddress = initTAddress(a).valueOr: | ||
return err(error) | ||
websocketPort = some(wsAddress.port) | ||
elif not a.isWsAddress() and tcpPort.isNone(): |
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.
It's a nitpick, but how about
if a.WsAddress():
...handle wsPort...
else:
...handle nonWsPort...
Just to skip doing the ws address check twice
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.
Another thing - this will obviously take a port from the first listen address it encounters - is that possible an issue? Could it mean we use non-public port instead of a public one, or is that not a problem anymore with all the previous changes regarding listen addresses?
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! Just refactored it to avoid doing the ws address check twice :)
Regarding the ports, the proc takes the tcp and ws(s) ports the switch got bound to - there should be only one of each (this listenAddrs
seq is part of the switch's struct).
Afterwards we recreate the App's and WakuNode's netConfig as if we had manually configured to bind to those ports.
These lines should not concern public ports: if we configured previously an extPort
, then NetConfig will be recreated with the same extPort
as before. And on the other hand, if we use the ext-multi-addr-only
CLI flag, we would still only (and blindly) announce the multiaddresses passed by the user.
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.
Tested locally with few options combinations and it worked as promised:)
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.
Wonderful PR! Thanks for it! 💯
Just added a few nitpicks ;P
Done! Thanks for the feedback! :) |
Description
Updating data structures to correctly reflect port number when the port is dynamically allocated by the kernel.
Changes
Issue
closes #2042