diff src/event/modules/ngx_kqueue_module.c @ 93:738fe44c70d5

nginx-0.0.1-2003-05-21-17:28:21 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 21 May 2003 13:28:21 +0000
parents 19cc647ecd91
children b48066122884
line wrap: on
line diff
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -66,7 +66,7 @@ ngx_event_module_t  ngx_kqueue_module_ct
         NULL,                              /* delete an connection */
         ngx_kqueue_process_events,         /* process the events */
         ngx_kqueue_init,                   /* init the events */
-        ngx_kqueue_done,                   /* done the events */
+        ngx_kqueue_done                    /* done the events */
     }
 
 };
@@ -343,22 +343,23 @@ static int ngx_kqueue_process_events(ngx
         }
 
         ev = (ngx_event_t *) event_list[i].udata;
-        instance = (uintptr_t) ev & 1;
-        ev = (void *) ((uintptr_t) ev & ~1);
-
-        /* It's a stale event from a file descriptor
-           that was just closed in this iteration */
-
-        if (ev->active == 0 || ev->instance != instance) {
-            ngx_log_debug(log, "stale kevent");
-            continue;
-        }
 
         switch (event_list[i].filter) {
 
         case EVFILT_READ:
         case EVFILT_WRITE:
 
+            instance = (uintptr_t) ev & 1;
+            ev = (void *) ((uintptr_t) ev & ~1);
+
+            /* It's a stale event from a file descriptor
+               that was just closed in this iteration */
+
+            if (ev->active == 0 || ev->instance != instance) {
+                ngx_log_debug(log, "stale kevent");
+                continue;
+            }
+
             ev->available = event_list[i].data;
 
             if (event_list[i].flags & EV_EOF) {