# HG changeset patch # User Igor Sysoev # Date 1074233748 0 # Node ID 1119faf4635a8297c1a0e476a8cf7bee8f49d7ac # Parent ce6b72fe33fecbf9a0e6e226cd4432775b1bbbd4 nginx-0.0.1-2004-01-16-09:15:48 import diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c --- a/src/event/modules/ngx_devpoll_module.c +++ b/src/event/modules/ngx_devpoll_module.c @@ -165,10 +165,6 @@ ngx_log_debug(cycle->log, "EV: %d" _ dpc nevents = dpcf->events; - if (ngx_event_timer_init(cycle) == NGX_ERROR) { - return NGX_ERROR; - } - ngx_io = ngx_os_io; ngx_event_actions = ngx_devpoll_module_ctx.actions; @@ -188,8 +184,6 @@ static void ngx_devpoll_done(ngx_cycle_t dp = -1; - ngx_event_timer_done(cycle); - ngx_free(change_list); ngx_free(event_list); ngx_free(change_index); diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c --- a/src/event/modules/ngx_kqueue_module.c +++ b/src/event/modules/ngx_kqueue_module.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru/en/ + * Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/ */ @@ -142,10 +142,6 @@ static int ngx_kqueue_init(ngx_cycle_t * nevents = kcf->events; - if (ngx_event_timer_init(cycle) == NGX_ERROR) { - return NGX_ERROR; - } - ngx_io = ngx_os_io; ngx_event_actions = ngx_kqueue_module_ctx.actions; @@ -174,8 +170,6 @@ static void ngx_kqueue_done(ngx_cycle_t ngx_kqueue = -1; - ngx_event_timer_done(cycle); - ngx_free(change_list); ngx_free(event_list); diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c --- a/src/event/modules/ngx_poll_module.c +++ b/src/event/modules/ngx_poll_module.c @@ -101,10 +101,6 @@ static int ngx_poll_init(ngx_cycle_t *cy NGX_ERROR); } - if (ngx_event_timer_init(cycle) == NGX_ERROR) { - return NGX_ERROR; - } - ngx_io = ngx_os_io; ngx_event_actions = ngx_poll_module_ctx.actions; @@ -117,8 +113,6 @@ static int ngx_poll_init(ngx_cycle_t *cy static void ngx_poll_done(ngx_cycle_t *cycle) { - ngx_event_timer_done(cycle); - ngx_free(event_list); ngx_free(event_index); ngx_free(ready_index); diff --git a/src/event/modules/ngx_select_module.c b/src/event/modules/ngx_select_module.c --- a/src/event/modules/ngx_select_module.c +++ b/src/event/modules/ngx_select_module.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru + * Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/ */ @@ -100,10 +100,6 @@ static int ngx_select_init(ngx_cycle_t * NGX_ERROR); } - if (ngx_event_timer_init(cycle) == NGX_ERROR) { - return NGX_ERROR; - } - ngx_io = ngx_os_io; ngx_event_actions = ngx_select_module_ctx.actions; @@ -122,8 +118,6 @@ static int ngx_select_init(ngx_cycle_t * static void ngx_select_done(ngx_cycle_t *cycle) { - ngx_event_timer_done(cycle); - ngx_free(event_index); ngx_free(ready_index); @@ -262,6 +256,7 @@ static int ngx_select_process_events(ngx work_write_fd_set = master_write_fd_set; timer = ngx_event_find_timer(); + ngx_old_elapsed_msec = ngx_elapsed_msec; if (timer) { #if (HAVE_SELECT_CHANGE_TIMEOUT) diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -120,10 +120,7 @@ static int ngx_event_init(ngx_cycle_t *c #endif - if (cycle->old_cycle == NULL) { - ngx_event_timer_init(cycle); - } - + ngx_event_timer_init(); ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); diff --git a/src/event/ngx_event_timer.c b/src/event/ngx_event_timer.c --- a/src/event/ngx_event_timer.c +++ b/src/event/ngx_event_timer.c @@ -14,26 +14,13 @@ ngx_rbtree_t *ngx_event_timer_rbtree; ngx_rbtree_t ngx_event_timer_sentinel; -int ngx_event_timer_init(ngx_cycle_t *cycle) +void ngx_event_timer_init(void) { if (ngx_event_timer_rbtree) { - return NGX_OK; + return; } ngx_event_timer_rbtree = &ngx_event_timer_sentinel; - -#if 0 - ngx_event_timer_sentinel.left = &ngx_event_timer_sentinel; - ngx_event_timer_sentinel.right = &ngx_event_timer_sentinel; - ngx_event_timer_sentinel.parent = &ngx_event_timer_sentinel; -#endif - - return NGX_OK; -} - - -void ngx_event_timer_done(ngx_cycle_t *cycle) -{ } diff --git a/src/event/ngx_event_timer.h b/src/event/ngx_event_timer.h --- a/src/event/ngx_event_timer.h +++ b/src/event/ngx_event_timer.h @@ -19,12 +19,7 @@ #define NGX_TIMER_RESOLUTION 1 -#if 0 -int ngx_event_timer_init(void); -#endif -/* STUB */ int ngx_event_timer_init(ngx_cycle_t *cycle); -/* STUB */ void ngx_event_timer_done(ngx_cycle_t *cycle); - +void ngx_event_timer_init(void); ngx_msec_t ngx_event_find_timer(void); void ngx_event_expire_timers(ngx_msec_t timer); diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -921,18 +921,21 @@ void ngx_http_finalize_request(ngx_http_ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - if (r->keepalive != 0 && clcf->keepalive_timeout > 0) { + if (!ngx_terminate + && !ngx_quit + && r->keepalive != 0 + && clcf->keepalive_timeout > 0) + { ngx_http_set_keepalive(r); + return; } else if (r->lingering_close && clcf->lingering_timeout > 0) { ngx_http_set_lingering_close(r); - - } else { - ngx_http_close_request(r, 0); - ngx_http_close_connection(r->connection); + return; } - return; + ngx_http_close_request(r, 0); + ngx_http_close_connection(r->connection); }