aboutsummaryrefslogtreecommitdiff
path: root/src/event/modules/ngx_kqueue_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/modules/ngx_kqueue_module.c')
-rw-r--r--src/event/modules/ngx_kqueue_module.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 81475f70e..b8398b5f1 100644
--- 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_ctx = {
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_log_t *log)
}
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) {