/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
{
int handle;
WSAEVENT hEventObject[2];
+ long events;
DWORD result, msec;
empth_t *pThread = TlsGetValue(dwTLSIndex);
int res;
handle = posix_fd2socket(fd);
CANT_HAPPEN(handle < 0);
- if (flags == EMPTH_FD_READ)
- WSAEventSelect(handle, hEventObject[0], FD_READ | FD_ACCEPT | FD_CLOSE);
- else if (flags == EMPTH_FD_WRITE)
- WSAEventSelect(handle, hEventObject[0], FD_WRITE | FD_CLOSE);
- else {
- logerror("bad flag %d passed to empth_select", flags);
- empth_exit();
- }
+ events = 0;
+ if (flags & EMPTH_FD_READ)
+ events |= FD_READ | FD_ACCEPT | FD_CLOSE;
+ if (flags & EMPTH_FD_WRITE)
+ events |= FD_WRITE | FD_CLOSE;
+ WSAEventSelect(handle, hEventObject[0], events);
if (timeout)
msec = timeout->tv_sec * 1000L + timeout->tv_usec / 1000L;
else
msec = WSA_INFINITE;
- result = WSAWaitForMultipleEvents(2, hEventObject, FALSE, msec,
- FALSE);
+ result = WSAWaitForMultipleEvents(2, hEventObject, FALSE, msec, FALSE);
switch (result) {
case WSA_WAIT_TIMEOUT: