Mercurial > hg > nginx-vendor-current
diff src/os/unix/ngx_process_cycle.c @ 290:f745bf973510 NGINX_0_5_15
nginx 0.5.15
*) Feature: the mail proxy supports authenticated SMTP proxying and the
"smtp_auth", "smtp_capablities", and "xclient" directives.
Thanks to Anton Yuzhaninov and Maxim Dounin.
*) Feature: now the keep-alive connections are closed just after
receiving the reconfiguration signal.
*) Change: the "imap" and "auth" directives were renamed to the "mail"
and "pop3_auth" directives.
*) Bugfix: a segmentation fault occurred in worker process if the
CRAM-MD5 authentication method was used and the APOP method was
disabled.
*) Bugfix: if the "starttls only" directive was used in POP3 protocol,
then nginx allowed authentication without switching to the SSL mode.
*) Bugfix: worker processes did not exit after reconfiguration and did
not rotate logs if the eventport method was used.
*) Bugfix: a worker process may got caught in an endless loop, if the
"ip_hash" directive was used.
*) Bugfix: now nginx does not log some alerts if eventport or /dev/poll
methods are used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 19 Mar 2007 00:00:00 +0300 |
parents | 704622b2528a |
children | 390b8f8309d6 |
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -454,7 +454,8 @@ ngx_signal_worker_processes(ngx_cycle_t if (ch.command) { if (ngx_write_channel(ngx_processes[i].channel[0], - &ch, sizeof(ngx_channel_t), cycle->log) == NGX_OK) + &ch, sizeof(ngx_channel_t), cycle->log) + == NGX_OK) { if (signo != ngx_signal_value(NGX_REOPEN_SIGNAL)) { ngx_processes[i].exiting = 1; @@ -663,6 +664,8 @@ ngx_master_process_exit(ngx_cycle_t *cyc 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; @@ -678,8 +681,8 @@ ngx_worker_process_cycle(ngx_cycle_t *cy ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); if (ngx_threads_n) { - if (ngx_init_threads(ngx_threads_n, - ccf->thread_stack_size, cycle) == NGX_ERROR) + if (ngx_init_threads(ngx_threads_n, ccf->thread_stack_size, cycle) + == NGX_ERROR) { /* fatal */ exit(2); @@ -704,7 +707,8 @@ ngx_worker_process_cycle(ngx_cycle_t *cy if (ngx_create_thread((ngx_tid_t *) &ngx_threads[n].tid, ngx_worker_thread_cycle, - (void *) &ngx_threads[n], cycle->log) != 0) + (void *) &ngx_threads[n], cycle->log) + != 0) { /* fatal */ exit(2); @@ -715,12 +719,27 @@ ngx_worker_process_cycle(ngx_cycle_t *cy #endif for ( ;; ) { - if (ngx_exiting - && ngx_event_timer_rbtree.root == ngx_event_timer_rbtree.sentinel) - { - ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); + + if (ngx_exiting) { + + c = cycle->connections; + + for (i = 0; i < cycle->connection_n; i++) { + + /* THREAD: lock */ - ngx_worker_process_exit(cycle); + if (c[i].fd != -1 && c[i].idle) { + c[i].close = 1; + c[i].read->handler(c[i].read); + } + } + + if (ngx_event_timer_rbtree.root == ngx_event_timer_rbtree.sentinel) + { + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); + + ngx_worker_process_exit(cycle); + } } ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); @@ -928,7 +947,8 @@ ngx_worker_process_init(ngx_cycle_t *cyc #endif if (ngx_add_channel_event(cycle, ngx_channel, NGX_READ_EVENT, - ngx_channel_handler) == NGX_ERROR) + ngx_channel_handler) + == NGX_ERROR) { /* fatal */ exit(2); @@ -1024,6 +1044,12 @@ ngx_channel_handler(ngx_event_t *ev) return; } + if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) { + if (ngx_add_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) { + return; + } + } + if (n == NGX_AGAIN) { return; }