-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
dgram: instantiate socket on creation #5496
Comments
What about lazily setting those options like what is currently done with |
That would be unnecessary. An interesting bonus is that if the system runs On Tue, Mar 1, 2016 at 12:20 AM, Brian White notifications@github.com
/Saúl |
@Trott... does this need to stay open? |
Making this change seems to be more involved than I originally thought. We would now need to pass the socket type to |
I'm going to close this as "sure, could be improved, but not really a bug, it's async, that's the way it is"... But feel free to re-open or comment if you think that's the wrong move. |
In Node 5.7.0 and all currently-supported previous versions, it is possible to try to trigger an exception (
EBADF
) with code such as this:As @saghul explains in #5023, this is because
dgram
instantiates the socket lazily withuv_udp_init()
. Ifuv_udp_init_ex()
were used instead, then the socket could be created and ready for the various.set*
functions upon creation.Such a change would probably be
semver-major
becausecreateSocket()
might throw whereas currently that is not the case.There are probably loads of other dangers and considerations. (I'm opening this issue so that the discussion can be had independently of the PR linked above, which is a relatively minor and safe change to a test file. This, on the other hand, would be a much bigger deal...)
The text was updated successfully, but these errors were encountered: