nginx-0.0.1-2003-01-24-19:09:40 import

This commit is contained in:
Igor Sysoev 2003-01-24 16:09:40 +00:00
parent 404326f68f
commit 830c4ce7af
2 changed files with 28 additions and 12 deletions

View File

@ -14,6 +14,7 @@
ngx_event_t *ngx_timer_queue;
int ngx_timer_hash_size;
static int ngx_timer_cur_queue;
int ngx_event_init_timer(ngx_log_t *log)
@ -21,6 +22,7 @@ int ngx_event_init_timer(ngx_log_t *log)
int i;
ngx_timer_hash_size = NGX_TIMER_HASH_SIZE;
ngx_timer_cur_queue = 0;
ngx_test_null(ngx_timer_queue,
ngx_alloc(ngx_timer_hash_size * sizeof(ngx_event_t), log),
@ -37,7 +39,6 @@ int ngx_event_init_timer(ngx_log_t *log)
void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
{
int n;
ngx_event_t *e;
#if (NGX_DEBUG_EVENT)
@ -50,18 +51,22 @@ void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
return;
}
n = timer % ngx_timer_hash_size;
#if (NGX_DEBUG_EVENT)
ngx_log_debug(ev->log, "timer slot: %d" _ n);
ngx_log_debug(ev->log, "timer slot: %d" _ ngx_timer_cur_queue);
#endif
for (e = ngx_timer_queue[n].timer_next;
e != &ngx_timer_queue[n] && timer > e->timer_delta;
for (e = ngx_timer_queue[ngx_timer_cur_queue].timer_next;
e != &ngx_timer_queue[ngx_timer_cur_queue] && timer > e->timer_delta;
e = e->timer_next)
{
timer -= e->timer_delta;
}
ngx_timer_cur_queue++;
if (ngx_timer_cur_queue >= ngx_timer_hash_size) {
ngx_timer_cur_queue = 0;
}
ev->timer_delta = timer;
ev->timer_next = e;

View File

@ -241,17 +241,28 @@ static int ngx_http_process_request_header(ngx_event_t *ev)
} while (rc == NGX_AGAIN && r->header_in->pos.mem < r->header_in->last.mem);
if (rc == NGX_OK) {
/* HTTP header done */
if (r->header_timeout) {
r->header_timeout = 0;
ngx_del_timer(ev);
ngx_add_timer(ev, ngx_http_client_header_timeout);
}
if (rc == NGX_OK)
return ngx_http_event_request_handler(r);
else
} else {
if (r->header_timeout) {
r->header_timeout = 0;
ngx_del_timer(ev);
ngx_add_timer(ev, ngx_http_client_header_timeout);
}
return rc;
}
}
static int ngx_http_process_request_line(ngx_http_request_t *r)