diff src/event/ngx_event.c @ 122:d25a1d6034f1 NGINX_0_3_8

nginx 0.3.8 *) Security: nginx now checks URI got from a backend in "X-Accel-Redirect" header line or in SSI file for the "/../" paths and zeroes. *) Change: nginx now does not treat the empty user name in the "Authorization" header line as valid one. *) Feature: the "ssl_session_timeout" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Feature: the "auth_http_header" directive of the ngx_imap_auth_http_module. *) Feature: the "add_header" directive. *) Feature: the ngx_http_realip_module. *) Feature: the new variables to use in the "log_format" directive: $bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri, $request_time, $request_length, $upstream_status, $upstream_response_time, $gzip_ratio, $uid_got, $uid_set, $connection, $pipe, and $msec. The parameters in the "%name" form will be canceled soon. *) Change: now the false variable values in the "if" directive are the empty string "" and string starting with "0". *) Bugfix: while using proxied or FastCGI-server nginx may leave connections and temporary files with client requests in open state. *) Bugfix: the worker processes did not flush the buffered logs on graceful exit. *) Bugfix: if the request URI was changes by the "rewrite" directive and the request was proxied in location given by regular expression, then the incorrect request was transferred to backend; bug appeared in 0.2.6. *) Bugfix: the "expires" directive did not remove the previous "Expires" header. *) Bugfix: nginx may stop to accept requests if the "rtsig" method and several worker processes were used. *) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in SSI commands. *) Bugfix: if the response was ended just after the SSI command and gzipping was used, then the response did not transferred complete or did not transferred at all.
author Igor Sysoev <http://sysoev.ru>
date Wed, 09 Nov 2005 00:00:00 +0300
parents e38f51cd0905
children df17fbafec8f
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -48,6 +48,7 @@ ngx_atomic_t         *ngx_connection_cou
 
 
 ngx_atomic_t         *ngx_accept_mutex_ptr;
+ngx_atomic_t         *ngx_accept_mutex_last_owner;
 ngx_atomic_t         *ngx_accept_mutex;
 ngx_uint_t            ngx_accept_mutex_held;
 ngx_msec_t            ngx_accept_mutex_delay;
@@ -249,10 +250,6 @@ ngx_process_events_and_timers(ngx_cycle_
     ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                    "timer delta: %M", delta);
 
-    if (delta) {
-        ngx_event_expire_timers();
-    }
-
     if (ngx_posted_accept_events) {
         ngx_event_process_posted(cycle, &ngx_posted_accept_events);
     }
@@ -261,6 +258,10 @@ ngx_process_events_and_timers(ngx_cycle_
         *ngx_accept_mutex = 0;
     }
 
+    if (delta) {
+        ngx_event_expire_timers();
+    }
+
     ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                    "posted events %p", ngx_posted_events);
 
@@ -470,6 +471,7 @@ ngx_event_module_init(ngx_cycle_t *cycle
     /* TODO: adjust cache line size, 128 is P4 cache line size */
 
     size = 128            /* ngx_accept_mutex */
+           + 128          /* ngx_accept_mutex_last_owner */
            + 128;         /* ngx_connection_counter */
 
 #if (NGX_STAT_STUB)
@@ -489,16 +491,17 @@ ngx_event_module_init(ngx_cycle_t *cycle
     }
 
     ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
-    ngx_connection_counter = (ngx_atomic_t *) (shared + 128);
+    ngx_accept_mutex_last_owner = (ngx_atomic_t *) (shared + 1 * 128);
+    ngx_connection_counter = (ngx_atomic_t *) (shared + 2 * 128);
 
 #if (NGX_STAT_STUB)
 
-    ngx_stat_accepted = (ngx_atomic_t *) (shared + 2 * 128);
-    ngx_stat_handled = (ngx_atomic_t *) (shared + 3 * 128);
-    ngx_stat_requests = (ngx_atomic_t *) (shared + 4 * 128);
-    ngx_stat_active = (ngx_atomic_t *) (shared + 5 * 128);
-    ngx_stat_reading = (ngx_atomic_t *) (shared + 6 * 128);
-    ngx_stat_writing = (ngx_atomic_t *) (shared + 7 * 128);
+    ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * 128);
+    ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * 128);
+    ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * 128);
+    ngx_stat_active = (ngx_atomic_t *) (shared + 6 * 128);
+    ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * 128);
+    ngx_stat_writing = (ngx_atomic_t *) (shared + 8 * 128);
 
 #endif
 
@@ -1082,10 +1085,10 @@ ngx_event_init_conf(ngx_cycle_t *cycle, 
 #endif
 #if (NGX_HAVE_RTSIG)
     ngx_uint_t           rtsig;
+    ngx_core_conf_t     *ccf;
 #endif
     ngx_int_t            i, connections;
     ngx_module_t        *module;
-    ngx_core_conf_t     *ccf;
     ngx_event_module_t  *event_module;
 
     connections = NGX_CONF_UNSET_UINT;
@@ -1189,8 +1192,6 @@ ngx_event_init_conf(ngx_cycle_t *cycle, 
         return NGX_CONF_OK;
     }
 
-#endif
-
     if (ecf->accept_mutex) {
         return NGX_CONF_OK;
     }
@@ -1205,6 +1206,12 @@ ngx_event_init_conf(ngx_cycle_t *cycle, 
                   "the \"rtsig\" method requires \"accept_mutex\" to be on");
 
     return NGX_CONF_ERROR;
+
+#else
+
+    return NGX_CONF_OK;
+
+#endif
 }