]> git.pond.sub.org Git - empserver/commitdiff
Don't log out player when update aborts a command under Windows
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Jul 2009 22:56:06 +0000 (18:56 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 30 Nov 2009 18:43:47 +0000 (19:43 +0100)
pthread.c's empth_select() returned 1 instead of 0 when empth_wakeup()
interrupted select().  This made io_input() attempt to read input,
which failed with WSAEWOULDBLOCK.  The failure then got propagated all
the way up, and the player got logged out.  Fix by returning 0 in that
case.

src/lib/empthread/ntthread.c

index a7509629d8631e54f0a78764e8f33decbba0cf88..17d4b53f92aa08ccd3eeb68a2552516e06b4c4c9 100644 (file)
@@ -568,6 +568,10 @@ empth_select(int fd, int flags, struct timeval *timeout)
     result = WSAWaitForMultipleEvents(2, hEventObject, FALSE, msec, FALSE);
 
     switch (result) {
+    case WSA_WAIT_EVENT_0:
+       res = 1;
+       break;
+    case WSA_WAIT_EVENT_0 + 1:
     case WSA_WAIT_TIMEOUT:
        res = 0;
        break;
@@ -576,7 +580,9 @@ empth_select(int fd, int flags, struct timeval *timeout)
        res = -1;
        break;
     default:
-       res = 1;
+       CANT_REACH();
+       errno = EINVAL;
+       res = -1;
     }
 
     WSAEventSelect(handle, hEventObject[0], 0);