-
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
net: report uv_tcp_open() errors #21428
Conversation
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.
LGTM with a question.
src/tcp_wrap.cc
Outdated
@@ -211,8 +211,9 @@ void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) { | |||
args.Holder(), | |||
args.GetReturnValue().Set(UV_EBADF)); | |||
int fd = static_cast<int>(args[0]->IntegerValue()); | |||
uv_tcp_open(&wrap->handle_, fd); | |||
int err = uv_tcp_open(&wrap->handle_, fd); | |||
wrap->set_fd(fd); |
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.
Should this be if (err == 0) wrap->set_fd(fd);
?
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 certainly could be. I'll update it. PipeWrap()
does it this way, but it also throws from C++ instead of returning the error code.
uv_tcp_open() can fail. Prior to this commit, any error was being silently ignored. This commit raises the errors. PR-URL: nodejs#21428 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Nit addressed. CI: https://ci.nodejs.org/job/node-test-pull-request/15565/. Only failure is #21425. |
uv_tcp_open() can fail. Prior to this commit, any error was being silently ignored. This commit raises the errors. PR-URL: #21428 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
uv_tcp_open()
can fail. Prior to this commit, any error was being silently ignored. This commit raises the errors.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes