Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a1719a9

Browse filesBrowse files
saghulMyles Borins
authored andcommitted
udp: use libuv API to get file descriptor
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>
1 parent b07c3a6 commit a1719a9
Copy full SHA for a1719a9

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Collapse file

‎src/udp_wrap.cc‎

Copy file name to clipboardExpand all lines: src/udp_wrap.cc
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,14 @@ void UDPWrap::New(const FunctionCallbackInfo<Value>& args) {
136136

137137

138138
void UDPWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
139+
int fd = -1;
139140
#if !defined(_WIN32)
140141
HandleScope scope(args.GetIsolate());
141142
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
142-
int fd = (wrap == nullptr) ? -1 : wrap->handle_.io_watcher.fd;
143-
args.GetReturnValue().Set(fd);
143+
if (wrap != nullptr)
144+
uv_fileno(reinterpret_cast<uv_handle_t*>(&wrap->handle_), &fd);
144145
#endif
146+
args.GetReturnValue().Set(fd);
145147
}
146148

147149

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.