From 5462dab8890c414154690d8a45b1384301b27436 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Sat, 9 Mar 2013 20:19:28 +0100 Subject: [PATCH] win/tcp: don't enable iocp sync bypass when iocp emulation is used When iocp sync bypass is in use libuv doesn't expect the system to generate events when an i/o operation completes synchronously. However when iocp emulation is enabled an event will always be generated because SetFileCompletionNotificationModes() doesn't stop OVERLAPPED.hEvent from becoming signaled. This should fix joyent/node#4959. --- src/win/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win/tcp.c b/src/win/tcp.c index 71582161..c3ef6533 100644 --- a/src/win/tcp.c +++ b/src/win/tcp.c @@ -113,7 +113,8 @@ static int uv_tcp_set_socket(uv_loop_t* loop, uv_tcp_t* handle, non_ifs_lsp = uv_tcp_non_ifs_lsp_ipv4; } - if (pSetFileCompletionNotificationModes && !non_ifs_lsp) { + if (pSetFileCompletionNotificationModes && + !(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) { if (pSetFileCompletionNotificationModes((HANDLE) socket, FILE_SKIP_SET_EVENT_ON_HANDLE | FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) {