]> granicus.if.org Git - libevent/commitdiff
Fix win32 connect() event handling.
authorNick Mathewson <nickm@torproject.org>
Wed, 21 Oct 2009 07:00:14 +0000 (07:00 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 21 Oct 2009 07:00:14 +0000 (07:00 +0000)
Christopher Davis reported:

    Connection failures aren't reported on Windows when
    using bufferevent_socket_connect, because Windows uses
    select's exceptfds to notify of failure, and libevent
    treats them like read events. Only the write event
    handler is currently used to handle connection events.

We should think hard about this one, since it changes
behavior from 1.4.x.  Anything that worked on Mac/Unix before
will work more consistently on Windows now... but this might
break stuff that worked only on Windows, but nowhere else.

Patch from Chris Davis.

svn:r1454

ChangeLog
WIN32-Code/win32.c

index f896936a888872fc57a7dce625b65d82f18d3ede..944818e7e5f48987b354c85baac53f6f04be1b42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,7 @@ Changes in 2.0.3-alpha:
  o Fix compilation for listener.h for C++ - missing extern "C".  Patch from Ferenc Szalai.
  o Make the event_base_loop() family of functions respect thread-safety better.  This should clear up a few hard-to-debug race conditions.
  o Fix a bug when using a specialized memory allocator on win32.
+ o Have the win32 select() backend label TCP-socket-connected events as EV_WRITE, not EV_READ.  This should bring it in line with the other backends, and improve portability.  Patch from Christopher Davis.
 
 
 Changes in 2.0.2-alpha:
index 3b0e808c704417a6848465d64ceb431bc0933580..d01b95911b1d61e722013a3bcc7c0b59e2468aa5 100644 (file)
@@ -296,7 +296,7 @@ win32_dispatch(struct event_base *base, struct timeval *tv)
        }
 
        fd_set_copy(win32op->readset_out, win32op->readset_in);
-       fd_set_copy(win32op->exset_out, win32op->readset_in);
+       fd_set_copy(win32op->exset_out, win32op->writeset_in);
        fd_set_copy(win32op->writeset_out, win32op->writeset_in);
 
        fd_count =
@@ -343,7 +343,7 @@ win32_dispatch(struct event_base *base, struct timeval *tv)
                        if (++i >= win32op->exset_out->fd_count)
                                i = 0;
                        s = win32op->exset_out->fd_array[i];
-                       evmap_io_active(base, s, EV_READ);
+                       evmap_io_active(base, s, EV_WRITE);
                }
        }
        if (win32op->writeset_out->fd_count) {