diff src/http/ngx_http_event.c @ 77:57c2e18d3572

nginx-0.0.1-2003-04-17-21:59:35 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 17 Apr 2003 17:59:35 +0000
parents 66de3f065886
children fccdb921e8b8
line wrap: on
line diff
--- a/src/http/ngx_http_event.c
+++ b/src/http/ngx_http_event.c
@@ -183,6 +183,7 @@ static int ngx_http_init_request(ngx_eve
 static int ngx_http_process_request(ngx_event_t *rev)
 {
     int                  n, rc;
+    ngx_event_t         *wev;
     ngx_connection_t    *c;
     ngx_http_request_t  *r;
     ngx_http_log_ctx_t  *lcx;
@@ -260,9 +261,16 @@ static int ngx_http_process_request(ngx_
             return ngx_http_finalize_request(r, rc);
         }
 
-        lcx = r->connection->log->data;
+        lcx = c->log->data;
         lcx->action = "processing client request";
 
+#if 0
+        wev = c->write;
+        ngx_add_timer(wev, 5000);
+        wev->delayed = 1;
+        wev->timer_set = 1;
+#endif
+
         rc = ngx_http_handler(r);
 
         /* a handler does its own processing */
@@ -657,13 +665,18 @@ int ngx_http_finalize_request(ngx_http_r
     /* NGX_AGAIN: a handler has done its work
                   but the transfer is still not completed */
 
+    wev = r->connection->write;
+    wev->event_handler = ngx_http_writer;
+
+    if (wev->delayed && wev->ready) {
+        return NGX_AGAIN;
+    }
+
     lcf = (ngx_http_core_loc_conf_t *)
                         ngx_http_get_module_loc_conf(r->main ? r->main : r,
                                                      ngx_http_core_module_ctx);
-    wev = r->connection->write;
-    wev->event_handler = ngx_http_writer;
+    ngx_add_timer(wev, lcf->send_timeout);
     wev->timer_set = 1;
-    ngx_add_timer(wev, lcf->send_timeout);
 
 #if (USE_KQUEUE)