-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
cluster,dgram: pass UDP bind flags from cluster worker #2611
Conversation
0910a73
to
d91756f
Compare
// Opening an existing fd is not supported for UDP handles. | ||
assert(typeof fd !== 'number' || fd < 0); | ||
|
||
var handle = newHandle(addressType); | ||
|
||
if (port || address) { | ||
var err = handle.bind(address, port || 0, 0); | ||
var err = handle.bind(address, port || 0, flags); |
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.
Can you replace the var
s with let
and const
where appropriate.
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.
For the whole file or just this one instance? Maybe that's best handled in a separate PR to avoid extra noise?
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.
Just the things that you're actually touching in this PR so there is no extra noise.
d91756f
to
7881719
Compare
// Opening an existing fd is not supported for UDP handles. | ||
assert(typeof fd !== 'number' || fd < 0); | ||
|
||
var handle = newHandle(addressType); | ||
|
||
if (port || address) { | ||
var err = handle.bind(address, port || 0, 0); | ||
let err = handle.bind(address, port || 0, flags); |
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 bit inconsistent to change var
to let
here, then use var
in newly added code below.
EDIT: I see @cjihrig asked you to.
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.
Yea, I meant in the context of the whole PR, not just this line.
7881719
to
72b9920
Compare
Ok, I've made the suggested improvements. However I still don't know why Windows fails with:
|
Previously, `reuseAddr: true` was being ignored when set inside a cluster worker. This commit passes the bind flags to the master so that the socket is bound appropriately.
72b9920
to
8af5f07
Compare
Ok, so it's the passing of UDP server handles that isn't supported on Windows, not |
Already fixed by c7be08c. |
Previously,
reuseAddr: true
was being ignored when set inside a cluster worker. This commit passes the bind flags to the master so that the socket is bound appropriately.Fixes: #2604