mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 06:03:31 -06:00
nginx-0.0.1-2003-01-24-19:09:40 import
This commit is contained in:
parent
404326f68f
commit
830c4ce7af
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
ngx_event_t *ngx_timer_queue;
|
ngx_event_t *ngx_timer_queue;
|
||||||
int ngx_timer_hash_size;
|
int ngx_timer_hash_size;
|
||||||
|
static int ngx_timer_cur_queue;
|
||||||
|
|
||||||
|
|
||||||
int ngx_event_init_timer(ngx_log_t *log)
|
int ngx_event_init_timer(ngx_log_t *log)
|
||||||
@ -21,6 +22,7 @@ int ngx_event_init_timer(ngx_log_t *log)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
ngx_timer_hash_size = NGX_TIMER_HASH_SIZE;
|
ngx_timer_hash_size = NGX_TIMER_HASH_SIZE;
|
||||||
|
ngx_timer_cur_queue = 0;
|
||||||
|
|
||||||
ngx_test_null(ngx_timer_queue,
|
ngx_test_null(ngx_timer_queue,
|
||||||
ngx_alloc(ngx_timer_hash_size * sizeof(ngx_event_t), log),
|
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)
|
void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
ngx_event_t *e;
|
ngx_event_t *e;
|
||||||
|
|
||||||
#if (NGX_DEBUG_EVENT)
|
#if (NGX_DEBUG_EVENT)
|
||||||
@ -50,18 +51,22 @@ void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = timer % ngx_timer_hash_size;
|
|
||||||
#if (NGX_DEBUG_EVENT)
|
#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
|
#endif
|
||||||
|
|
||||||
for (e = ngx_timer_queue[n].timer_next;
|
for (e = ngx_timer_queue[ngx_timer_cur_queue].timer_next;
|
||||||
e != &ngx_timer_queue[n] && timer > e->timer_delta;
|
e != &ngx_timer_queue[ngx_timer_cur_queue] && timer > e->timer_delta;
|
||||||
e = e->timer_next)
|
e = e->timer_next)
|
||||||
{
|
{
|
||||||
timer -= e->timer_delta;
|
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_delta = timer;
|
||||||
|
|
||||||
ev->timer_next = e;
|
ev->timer_next = e;
|
||||||
|
@ -241,16 +241,27 @@ 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);
|
} while (rc == NGX_AGAIN && r->header_in->pos.mem < r->header_in->last.mem);
|
||||||
|
|
||||||
if (r->header_timeout) {
|
if (rc == NGX_OK) {
|
||||||
r->header_timeout = 0;
|
/* HTTP header done */
|
||||||
ngx_del_timer(ev);
|
|
||||||
ngx_add_timer(ev, ngx_http_client_header_timeout);
|
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);
|
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;
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user