Skip to content
This repository
Browse code

Fixes the kqueue() backend.

  • Loading branch information...
commit 0798def7eed75b6fb2a0ad1323c34bd9c5965cbe 1 parent 06f9ae1
Alvaro Lopez Ortega authored January 03, 2012

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. 15  cherokee/fdpoll-kqueue.c
15  cherokee/fdpoll-kqueue.c
@@ -214,7 +214,7 @@ _watch (cherokee_fdpoll_kqueue_t *fdp, int timeout_msecs)
214 214
 		LOG_ERRNO (errno, cherokee_err_error, CHEROKEE_ERROR_FDPOLL_KQUEUE);
215 215
 		return 0;
216 216
 
217  
-	} else if (n_events > 0) {
  217
+	} else if (n_events >= 0) {
218 218
 		memset (fdp->fdevents, 0, FDPOLL(fdp)->system_nfiles * sizeof(int));
219 219
 
220 220
 		for (i = 0; i < n_events; ++i) {
@@ -254,11 +254,16 @@ _check (cherokee_fdpoll_kqueue_t *fdp, int fd, int rw_mode)
254 254
 		return 1;
255 255
 	}
256 256
 
257  
-	if (rw_mode & poll_mode_read) {
258  
-		events |= KQUEUE_READ_EVENT;
  257
+	if ((rw_mode & poll_mode_read) &&
  258
+	    (events & KQUEUE_READ_EVENT))
  259
+	{
  260
+		return 1;
259 261
 	}
260  
-	if (rw_mode & poll_mode_write) {
261  
-		events |= KQUEUE_WRITE_EVENT;
  262
+
  263
+	if ((rw_mode & poll_mode_write) &&
  264
+	    (events & KQUEUE_WRITE_EVENT))
  265
+	{
  266
+		return 1;
262 267
 	}
263 268
 
264 269
 	return events;

0 notes on commit 0798def

Please sign in to comment.
Something went wrong with that request. Please try again.