Skip to content

Commit

Permalink
udp: use libuv API to get file descriptor
Browse files Browse the repository at this point in the history
Refs: nodejs#6838
PR-URL: nodejs#6908
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
saghul committed Jul 11, 2016
1 parent 9eedea9 commit 13103c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/udp_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ void UDPWrap::New(const FunctionCallbackInfo<Value>& args) {


void UDPWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
int fd = -1;
#if !defined(_WIN32)
HandleScope scope(args.GetIsolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
int fd = (wrap == nullptr) ? -1 : wrap->handle_.io_watcher.fd;
args.GetReturnValue().Set(fd);
if (wrap != nullptr)
uv_fileno(reinterpret_cast<uv_handle_t*>(&wrap->handle_), &fd);
#endif
args.GetReturnValue().Set(fd);
}


Expand Down

0 comments on commit 13103c2

Please sign in to comment.