Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes the Win32 backend

  • Loading branch information...
commit 984d28cd6d37ca19e499e4164a0ed2ac7de04331 1 parent 7fc51aa
@alobbs alobbs authored
Showing with 21 additions and 18 deletions.
  1. +21 −18 cherokee/fdpoll-win32.c
View
39 cherokee/fdpoll-win32.c
@@ -78,7 +78,7 @@ _free (cherokee_fdpoll_select_t *fdp)
static ret_t
-_add (cherokee_fdpoll_select_t *fdp, int fd, int rw)
+_add (cherokee_fdpoll_select_t *fdp, int fd, int rw_mode)
{
cherokee_fdpoll_t *nfd = FDPOLL(fdp);
@@ -90,15 +90,13 @@ _add (cherokee_fdpoll_select_t *fdp, int fd, int rw)
}
fdp->select_fds[nfd->npollfds] = fd;
- switch (rw) {
- case FDPOLL_MODE_READ:
- FD_SET (fd, &fdp->master_rfdset);
- break;
- case FDPOLL_MODE_WRITE:
- FD_SET (fd, &fdp->master_wfdset);
- break;
- default:
- break;
+
+ if (rw_mode & poll_mode_read) {
+ FD_SET (fd, &fdp->master_rfdset);
+ }
+
+ if (rw_mode & poll_mode_write) {
+ FD_SET (fd, &fdp->master_wfdset);
}
if (fd > fdp->maxfd) {
@@ -140,7 +138,7 @@ _del (cherokee_fdpoll_select_t *fdp, int fd)
static ret_t
-_set_mode (cherokee_fdpoll_select_t *fdp, int fd, int rw)
+_set_mode (cherokee_fdpoll_select_t *fdp, int fd, int rw_mode)
{
ret_t ret;
@@ -148,18 +146,23 @@ _set_mode (cherokee_fdpoll_select_t *fdp, int fd, int rw)
if (unlikely(ret < ret_ok))
return ret;
- return _add (fdp, fd, rw);
+ return _add (fdp, fd, rw_mode);
}
static int
-_check (cherokee_fdpoll_select_t *fdp, int fd, int rw)
+_check (cherokee_fdpoll_select_t *fdp, int fd, int rw_mode)
{
- switch (rw) {
- case FDPOLL_MODE_READ:
- return FD_ISSET (fd, &fdp->working_rfdset);
- case FDPOLL_MODE_WRITE:
- return FD_ISSET (fd, &fdp->working_wfdset);
+ if ((rw_mode & poll_mode_read) &&
+ (FD_ISSET (fd, &fdp->working_rfdset)))
+ {
+ return 1;
+ }
+
+ if ((rw_mode & poll_mode_write) &&
+ (FD_ISSET (fd, &fdp->working_wfdset)))
+ {
+ return 1;
}
return 0;
Please sign in to comment.
Something went wrong with that request. Please try again.