Browse Source

udp: use libuv API to get file descriptor

Refs: https://github.com/nodejs/node/pull/6838
PR-URL: https://github.com/nodejs/node/pull/6908
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Saúl Ibarra Corretgé 9 years ago
committed by Rod Vagg
parent
commit
36ed4a2d7a
  1. 6
      src/udp_wrap.cc

6
src/udp_wrap.cc

@ -139,12 +139,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);
}

Loading…
Cancel
Save