summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2011-02-03 22:35:00 +0100
committerRyan Dahl <ry@tinyclouds.org>2011-02-03 14:05:51 -0800
commit8ee9c53c77188acdadc2acce214bcc6dd610f083 (patch)
treead4f02f57c7280a1138611972d9520d728f40d67
parentd8d627e2d4ac67daf60f43e38f7d487855f43c47 (diff)
downloadnodejs-8ee9c53c77188acdadc2acce214bcc6dd610f083.tar.gz
nodejs-8ee9c53c77188acdadc2acce214bcc6dd610f083.tar.bz2
nodejs-8ee9c53c77188acdadc2acce214bcc6dd610f083.zip
Fix problem with libev/select on windows.
Patch by Marc Lehmann. This fix should be included in the next libev release.
-rw-r--r--deps/libev/ev.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/deps/libev/ev.c b/deps/libev/ev.c
index 6d8676d42..3d956b53d 100644
--- a/deps/libev/ev.c
+++ b/deps/libev/ev.c
@@ -967,6 +967,31 @@ fd_reify (EV_P)
{
int i;
+#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
+ for (i = 0; i < fdchangecnt; ++i)
+ {
+ int fd = fdchanges [i];
+ ANFD *anfd = anfds + fd;
+
+ if (anfd->reify & EV__IOFDSET)
+ {
+ SOCKET handle = EV_FD_TO_WIN32_HANDLE (fd);
+
+ if (handle != anfd->handle)
+ {
+ unsigned long arg;
+
+ assert (("libev: only socket fds supported in this configuration", ioctlsocket (handle, FIONREAD, &arg) == 0));
+
+ /* handle changed, but fd didn't - we need to do it in two steps */
+ backend_modify (EV_A_ fd, anfd->events, 0);
+ anfd->events = 0;
+ anfd->handle = handle;
+ }
+ }
+ }
+#endif
+
for (i = 0; i < fdchangecnt; ++i)
{
int fd = fdchanges [i];
@@ -978,15 +1003,6 @@ fd_reify (EV_P)
anfd->reify = 0;
-#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
- if (o_reify & EV__IOFDSET)
- {
- unsigned long arg;
- anfd->handle = EV_FD_TO_WIN32_HANDLE (fd);
- assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
- }
-#endif
-
/*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */
{
anfd->events = 0;