We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b07c3a6 commit a1719a9Copy full SHA for a1719a9
src/udp_wrap.cc
@@ -136,12 +136,14 @@ void UDPWrap::New(const FunctionCallbackInfo<Value>& args) {
136
137
138
void UDPWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
139
+ int fd = -1;
140
#if !defined(_WIN32)
141
HandleScope scope(args.GetIsolate());
142
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
- int fd = (wrap == nullptr) ? -1 : wrap->handle_.io_watcher.fd;
143
- args.GetReturnValue().Set(fd);
+ if (wrap != nullptr)
144
+ uv_fileno(reinterpret_cast<uv_handle_t*>(&wrap->handle_), &fd);
145
#endif
146
+ args.GetReturnValue().Set(fd);
147
}
148
149
0 commit comments