comparison src/http/ngx_http_request.c @ 212:679f60139863

nginx-0.0.1-2003-12-19-11:15:11 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 19 Dec 2003 08:15:11 +0000
parents 00cafae0bdf1
children f536f91e8e99
comparison
equal deleted inserted replaced
211:fd9fecc4193f 212:679f60139863
105 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) { 105 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
106 ngx_http_close_connection(c); 106 ngx_http_close_connection(c);
107 return; 107 return;
108 } 108 }
109 #endif 109 #endif
110
111 ngx_atomic_inc(ngx_http_reading_state);
110 } 112 }
111 113
112 114
113 static void ngx_http_init_request(ngx_event_t *rev) 115 static void ngx_http_init_request(ngx_event_t *rev)
114 { 116 {
125 127
126 c = rev->data; 128 c = rev->data;
127 129
128 if (rev->timedout) { 130 if (rev->timedout) {
129 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); 131 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
132 ngx_atomic_dec(ngx_http_reading_state);
130 ngx_http_close_connection(c); 133 ngx_http_close_connection(c);
131 return; 134 return;
132 } 135 }
133 136
134 if (c->data) { 137 if (c->data) {
1262 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1265 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1263 1266
1264 rev = c->read; 1267 rev = c->read;
1265 rev->event_handler = ngx_http_lingering_close_handler; 1268 rev->event_handler = ngx_http_lingering_close_handler;
1266 1269
1267 r->lingering_time = ngx_time() + clcf->lingering_time / 1000; 1270 r->lingering_time = ngx_cached_time + clcf->lingering_time / 1000;
1268 ngx_add_timer(rev, clcf->lingering_timeout); 1271 ngx_add_timer(rev, clcf->lingering_timeout);
1269 1272
1270 if (ngx_handle_level_read_event(rev) == NGX_ERROR) { 1273 if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
1271 ngx_http_close_request(r, 0); 1274 ngx_http_close_request(r, 0);
1272 ngx_http_close_connection(c); 1275 ngx_http_close_connection(c);
1324 ngx_http_close_request(r, 0); 1327 ngx_http_close_request(r, 0);
1325 ngx_http_close_connection(c); 1328 ngx_http_close_connection(c);
1326 return; 1329 return;
1327 } 1330 }
1328 1331
1329 timer = r->lingering_time - ngx_time(); 1332 timer = r->lingering_time - ngx_cached_time;
1330 if (timer <= 0) { 1333 if (timer <= 0) {
1331 ngx_http_close_request(r, 0); 1334 ngx_http_close_request(r, 0);
1332 ngx_http_close_connection(c); 1335 ngx_http_close_connection(c);
1333 return; 1336 return;
1334 } 1337 }