nginx-0.0.1-2003-12-19-11:15:11 import
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 91fa231..592e1b6 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -8,7 +8,16 @@
 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 
 
-int  ngx_http_max_module;
+int         ngx_http_max_module;
+
+ngx_uint_t  ngx_http_reading_state;
+ngx_uint_t  ngx_http_processing_state;
+ngx_uint_t  ngx_http_writing_state;
+ngx_uint_t  ngx_http_lingering_close_state;
+ngx_uint_t  ngx_http_keepalive_state;
+
+ngx_uint_t  ngx_http_total_requests;
+uint64_t    ngx_http_total_sent;
 
 
 int  (*ngx_http_top_header_filter) (ngx_http_request_t *r);
diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h
index 58d918b..954f695 100644
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -87,7 +87,17 @@
 extern ngx_module_t  ngx_http_module;
 
 
-extern int  ngx_max_module;
+extern int         ngx_max_module;
+
+extern ngx_uint_t  ngx_http_reading_state;
+extern ngx_uint_t  ngx_http_processing_state;
+extern ngx_uint_t  ngx_http_writing_state;
+extern ngx_uint_t  ngx_http_lingering_close_state;
+extern ngx_uint_t  ngx_http_keepalive_state;
+
+extern ngx_uint_t  ngx_http_total_requests;
+extern uint64_t    ngx_http_total_sent;
+
 
 
 /* STUB */
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 66bf9be..c484d27 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -107,6 +107,8 @@
         return;
     }
 #endif
+
+    ngx_atomic_inc(ngx_http_reading_state);
 }
 
 
@@ -127,6 +129,7 @@
 
     if (rev->timedout) {
         ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
+        ngx_atomic_dec(ngx_http_reading_state);
         ngx_http_close_connection(c);
         return;
     }
@@ -1264,7 +1267,7 @@
     rev = c->read;
     rev->event_handler = ngx_http_lingering_close_handler;
 
-    r->lingering_time = ngx_time() + clcf->lingering_time / 1000;
+    r->lingering_time = ngx_cached_time + clcf->lingering_time / 1000;
     ngx_add_timer(rev, clcf->lingering_timeout);
 
     if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
@@ -1326,7 +1329,7 @@
         return;
     }
 
-    timer = r->lingering_time - ngx_time();
+    timer = r->lingering_time - ngx_cached_time;
     if (timer <= 0) {
         ngx_http_close_request(r, 0);
         ngx_http_close_connection(c);