/* $Id$ */
#include "silcincludes.h"
-#includd "silcschedule_i.h"
+#include "silcschedule_i.h"
/* Our "select()" for WIN32. This mimics the behaviour of select() system
call. It does not call the Winsock's select() though. Its functions
*/
-int silc_select(SilcScheduleFd fds, uint32 fds_count, struct timeval *timeout)
+int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count, struct timeval *timeout)
{
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
DWORD ready, curtime, timeo;
continue;
if (fds[i].events & SILC_TASK_READ)
- handles[nhandles++] = (HANDLE)i;
+ handles[nhandles++] = (HANDLE)fds[i].fd;
- if (fds[i].events & SILC_TASK_WRITE)
+ /* If writing then just set the bit and return */
+ if (fds[i].events & SILC_TASK_WRITE) {
+ fds[i].revents = SILC_TASK_WRITE;
return 1;
+ }
fds[i].revents = 0;
}
/* Give the wait another try */
goto retry;
- } else if (ready >= WAIT_OBJECT_0 && ready < WAIT_OBJECT_0 + nhandles &&
- readfds) {
+ } else if (ready >= WAIT_OBJECT_0 && ready < WAIT_OBJECT_0 + nhandles) {
/* Some other event, like SOCKET or something. */
/* Go through all fds even though only one was set. This is to avoid