comparison src/event/modules/ngx_kqueue_module.c @ 132:91372f004adf NGINX_0_3_13

nginx 0.3.13 *) Feature: the IMAP/POP3 proxy supports STARTTLS and STLS. *) Bugfix: the IMAP/POP3 proxy did not work with the select, poll, and /dev/poll methods. *) Bugfix: in SSI handling. *) Bugfix: now Solaris sendfilev() is not used to transfer the client request body to FastCGI-server via the unix domain socket. *) Bugfix: the "auth_basic" directive did not disable the authorization; bug appeared in 0.3.11.
author Igor Sysoev <http://sysoev.ru>
date Mon, 05 Dec 2005 00:00:00 +0300
parents e38f51cd0905
children 3314be145cb9
comparison
equal deleted inserted replaced
131:add6b1e86d38 132:91372f004adf
274 274
275 static ngx_int_t 275 static ngx_int_t
276 ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags) 276 ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags)
277 { 277 {
278 ngx_int_t rc; 278 ngx_int_t rc;
279 #if 0
279 ngx_event_t *e; 280 ngx_event_t *e;
280 ngx_connection_t *c; 281 ngx_connection_t *c;
282 #endif
281 283
282 ev->active = 1; 284 ev->active = 1;
283 ev->disabled = 0; 285 ev->disabled = 0;
284 ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0; 286 ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0;
285 287
286 ngx_mutex_lock(list_mutex); 288 ngx_mutex_lock(list_mutex);
287 289
288 #if 1 290 #if 0
289 291
290 if (nchanges > 0 292 if (ev->index < (u_int) nchanges
291 && ev->index < (u_int) nchanges
292 && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1) 293 && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
293 == (uintptr_t) ev) 294 == (uintptr_t) ev)
294 { 295 {
295 if (change_list[ev->index].flags == EV_DISABLE) { 296 if (change_list[ev->index].flags == EV_DISABLE) {
296 297
297 /* 298 /*
298 * if the EV_DISABLE is still not passed to a kernel 299 * if the EV_DISABLE is still not passed to a kernel
344 ev->active = 0; 345 ev->active = 0;
345 ev->disabled = 0; 346 ev->disabled = 0;
346 347
347 ngx_mutex_lock(list_mutex); 348 ngx_mutex_lock(list_mutex);
348 349
349 #if 1 350 if (ev->index < (u_int) nchanges
350
351 if (nchanges > 0
352 && ev->index < (u_int) nchanges
353 && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1) 351 && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
354 == (uintptr_t) ev) 352 == (uintptr_t) ev)
355 { 353 {
356 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, 354 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
357 "kevent deleted: %d: ft:%d", 355 "kevent deleted: %d: ft:%d",
358 ngx_event_ident(ev->data), event); 356 ngx_event_ident(ev->data), event);
359 357
360 /* if the event is still not passed to a kernel we will not pass it */ 358 /* if the event is still not passed to a kernel we will not pass it */
361 359
362 if (ev->index < (u_int) --nchanges) { 360 nchanges--;
361
362 if (ev->index < (u_int) nchanges) {
363 e = (ngx_event_t *) 363 e = (ngx_event_t *)
364 ((uintptr_t) change_list[nchanges].udata & (uintptr_t) ~1); 364 ((uintptr_t) change_list[nchanges].udata & (uintptr_t) ~1);
365 change_list[ev->index] = change_list[nchanges]; 365 change_list[ev->index] = change_list[nchanges];
366 e->index = ev->index; 366 e->index = ev->index;
367 } 367 }
368 368
369 ngx_mutex_unlock(list_mutex); 369 ngx_mutex_unlock(list_mutex);
370 370
371 return NGX_OK; 371 return NGX_OK;
372 } 372 }
373
374 #endif
375 373
376 /* 374 /*
377 * when the file descriptor is closed the kqueue automatically deletes 375 * when the file descriptor is closed the kqueue automatically deletes
378 * its filters so we do not need to delete explicity the event 376 * its filters so we do not need to delete explicity the event
379 * before the closing the file descriptor. 377 * before the closing the file descriptor.
549 547
550 ngx_kqueue_dump_event(cycle->log, &event_list[i]); 548 ngx_kqueue_dump_event(cycle->log, &event_list[i]);
551 549
552 if (event_list[i].flags & EV_ERROR) { 550 if (event_list[i].flags & EV_ERROR) {
553 ngx_log_error(NGX_LOG_ALERT, cycle->log, event_list[i].data, 551 ngx_log_error(NGX_LOG_ALERT, cycle->log, event_list[i].data,
554 "kevent() error on %d", event_list[i].ident); 552 "kevent() error on %d filter:%d flags:%04Xd",
553 event_list[i].ident, event_list[i].filter,
554 event_list[i].flags);
555 continue; 555 continue;
556 } 556 }
557 557
558 #if (NGX_HAVE_TIMER_EVENT) 558 #if (NGX_HAVE_TIMER_EVENT)
559 559