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: #6838
PR-URL: #6908
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
saghul authored and Myles Borins committed Jul 14, 2016
1 parent 139f9f0 commit 973abab
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 973abab

Please sign in to comment.