[IOMultiplexerV2] fixed compiling issue with newer MinGW builds...
[NextIRCd.git] / src / IOHandler / IOEngine_win32.c
index a5226ae792c0f16ea8f121dc66a1eff142cdbabf..0a0a7acf73c86a31ca2b4a6e0bcadf36cf95d5d7 100644 (file)
 #include "IOTimer.h"
 
 #ifdef WIN32
-
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
 #define _WIN32_WINNT 0x501
-#include <windows.h>
 #include <winsock2.h>
+#include <windows.h>
 
 /* This is massively kludgy.  Unfortunately, the only performant I/O
  * multiplexer with halfway decent semantics under Windows is
@@ -118,7 +120,7 @@ static long engine_win32_events(struct _IOSocket *iosock) {
        if(iosock->socket_flags & IOSOCKETFLAG_CONNECTING)
                return FD_CONNECT;
        
-       return FD_READ | FD_CLOSE | (iosocket_wants_writes(iosock) ? FD_WRITE : 0);
+       return FD_CLOSE | (iosocket_wants_reads(iosock) ? FD_READ : 0) | (iosocket_wants_writes(iosock) ? FD_WRITE : 0);
 }
 
 static void engine_win32_update(struct _IOSocket *iosock) {