Mercurial > hg > nginx-vendor-1-0
diff src/os/unix/ngx_process_cycle.c @ 112:408f195b3482 NGINX_0_3_3
nginx 0.3.3
*) Change: the "bl" and "af" parameters of the "listen" directive was
renamed to the "backlog" and "accept_filter".
*) Feature: the "rcvbuf" and "sndbuf" parameters of the "listen"
directive.
*) Change: the "$msec" log parameter does not require now the
additional the gettimeofday() system call.
*) Feature: the -t switch now tests the "listen" directives.
*) Bugfix: if the invalid address was specified in the "listen"
directive, then after the -HUP signal nginx left an open socket in
the CLOSED state.
*) Bugfix: the mime type may be incorrectly set to default value for
index file with variable in the name; bug appeared in 0.3.0.
*) Feature: the "timer_resolution" directive.
*) Feature: the millisecond "$upstream_response_time" log parameter.
*) Bugfix: a temporary file with client request body now is removed
just after the response header was transferred to a client.
*) Bugfix: OpenSSL 0.9.6 compatibility.
*) Bugfix: the SSL certificate and key file paths could not be relative.
*) Bugfix: the "ssl_prefer_server_ciphers" directive did not work in
the ngx_imap_ssl_module.
*) Bugfix: the "ssl_protocols" directive allowed to specify the single
protocol only.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 19 Oct 2005 00:00:00 +0400 |
parents | cf3d6edb3ad6 |
children | e85dca77c46a |
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -21,7 +21,7 @@ static void ngx_worker_process_init(ngx_ static void ngx_channel_handler(ngx_event_t *ev); #if (NGX_THREADS) static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle); -static void *ngx_worker_thread_cycle(void *data); +static ngx_thread_value_t ngx_worker_thread_cycle(void *data); #endif #if 0 static void ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data); @@ -69,7 +69,6 @@ ngx_master_process_cycle(ngx_cycle_t *cy ngx_int_t i; ngx_uint_t n; sigset_t set; - struct timeval tv; struct itimerval itv; ngx_uint_t live; ngx_msec_t delay; @@ -145,8 +144,7 @@ ngx_master_process_cycle(ngx_cycle_t *cy sigsuspend(&set); - ngx_gettimeofday(&tv); - ngx_time_update(tv.tv_sec); + ngx_time_update(0, 0); ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "wake up"); @@ -275,7 +273,7 @@ ngx_single_process_cycle(ngx_cycle_t *cy for ( ;; ) { ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); - ngx_process_events(cycle); + ngx_process_events_and_timers(cycle); if (ngx_terminate || ngx_quit) { ngx_master_exit(cycle); @@ -645,6 +643,8 @@ ngx_master_exit(ngx_cycle_t *cycle) static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) { + ngx_uint_t i; + ngx_connection_t *c; #if (NGX_THREADS) ngx_int_t n; ngx_err_t err; @@ -657,11 +657,6 @@ ngx_worker_process_cycle(ngx_cycle_t *cy #if (NGX_THREADS) - if (ngx_time_mutex_init(cycle->log) == NGX_ERROR) { - /* fatal */ - exit(2); - } - ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); if (ngx_threads_n) { @@ -731,7 +726,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cy ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); - ngx_process_events(cycle); + ngx_process_events_and_timers(cycle); if (ngx_terminate) { ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); @@ -740,6 +735,21 @@ ngx_worker_process_cycle(ngx_cycle_t *cy ngx_wakeup_worker_threads(cycle); #endif + c = cycle->connections; + for (i = 0; i < cycle->connection_n; i++) { + if (c[i].fd != -1 + && c[i].read + && !c[i].read->accept + && !c[i].read->channel) + { + ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, + "open socket #%d left in %ui connection, " + "aborting", + c[i].fd, i); + ngx_abort(); + } + } + /* * we do not destroy cycle->pool here because a signal handler * that uses cycle->log can be called at this point @@ -1054,7 +1064,7 @@ ngx_wakeup_worker_threads(ngx_cycle_t *c } -static void * +static ngx_thread_value_t ngx_worker_thread_cycle(void *data) { ngx_thread_t *thr = data; @@ -1075,7 +1085,7 @@ ngx_worker_thread_cycle(void *data) if (err) { ngx_log_error(NGX_LOG_ALERT, cycle->log, err, ngx_thread_sigmask_n " failed"); - return (void *) 1; + return (ngx_thread_value_t) 1; } ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0, @@ -1085,25 +1095,23 @@ ngx_worker_thread_cycle(void *data) tls = ngx_calloc(sizeof(ngx_core_tls_t), cycle->log); if (tls == NULL) { - return (void *) 1; + return (ngx_thread_value_t) 1; } err = ngx_thread_set_tls(ngx_core_tls_key, tls); if (err != 0) { ngx_log_error(NGX_LOG_ALERT, cycle->log, err, ngx_thread_set_tls_n " failed"); - return (void *) 1; + return (ngx_thread_value_t) 1; } - if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) { - return (void *) 1; - } + ngx_mutex_lock(ngx_posted_events_mutex); for ( ;; ) { thr->state = NGX_THREAD_FREE; if (ngx_cond_wait(thr->cv, ngx_posted_events_mutex) == NGX_ERROR) { - return (void *) 1; + return (ngx_thread_value_t) 1; } if (ngx_terminate) { @@ -1115,22 +1123,22 @@ ngx_worker_thread_cycle(void *data) "thread " NGX_TID_T_FMT " is done", ngx_thread_self()); - return (void *) 0; + return (ngx_thread_value_t) 0; } thr->state = NGX_THREAD_BUSY; if (ngx_event_thread_process_posted(cycle) == NGX_ERROR) { - return (void *) 1; + return (ngx_thread_value_t) 1; } if (ngx_event_thread_process_posted(cycle) == NGX_ERROR) { - return (void *) 1; + return (ngx_thread_value_t) 1; } if (ngx_process_changes) { if (ngx_process_changes(cycle, 1) == NGX_ERROR) { - return (void *) 1; + return (ngx_thread_value_t) 1; } } } @@ -1185,7 +1193,7 @@ ngx_garbage_collector_cycle(ngx_cycle_t ngx_add_timer(ev, 60 * 60 * 1000); - ngx_process_events(cycle); + ngx_process_events_and_timers(cycle); } }