summaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_process_cycle.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-03-19 13:44:42 +0000
committerJonathan Kolb <jon@b0g.us>2007-03-19 13:44:42 +0000
commit310da76bdd131de0ea49c3aba2d54858d34273b9 (patch)
treecd53a138d2a958b4e2e0bc4e18726c879ac5d335 /src/os/unix/ngx_process_cycle.c
parentbfec3c49c20668e1e4058a7bc94e76ae27f73e65 (diff)
downloadnginx-310da76bdd131de0ea49c3aba2d54858d34273b9.tar.gz
Changes with nginx 0.5.15 19 Mar 2007v0.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. *) 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.
Diffstat (limited to 'src/os/unix/ngx_process_cycle.c')
-rw-r--r--src/os/unix/ngx_process_cycle.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index c8586f6e4..90993966d 100644
--- 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 *cycle, int signo)
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 *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;
@@ -678,8 +681,8 @@ ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
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 *cycle, void *data)
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 *cycle, void *data)
#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");
- ngx_worker_process_exit(cycle);
+ if (ngx_exiting) {
+
+ c = cycle->connections;
+
+ for (i = 0; i < cycle->connection_n; i++) {
+
+ /* THREAD: lock */
+
+ 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 *cycle, ngx_uint_t priority)
#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;
}