comparison src/http/modules/proxy/ngx_http_proxy_handler.c @ 144:ef8c87afcfc5

nginx-0.0.1-2003-10-12-20:49:16 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 12 Oct 2003 16:49:16 +0000
parents 5526213be452
children 5afee0074707
comparison
equal deleted inserted replaced
143:5526213be452 144:ef8c87afcfc5
290 ngx_del_timer(c->write); 290 ngx_del_timer(c->write);
291 } 291 }
292 292
293 if (chain) { 293 if (chain) {
294 ngx_add_timer(c->write, p->lcf->send_timeout); 294 ngx_add_timer(c->write, p->lcf->send_timeout);
295 c->write->timer_set = 1;
296 295
297 } else { 296 } else {
298 c->write->timer_set = 0;
299 /* TODO: del event */ 297 /* TODO: del event */
300 } 298 }
301 299
302 return; 300 return;
303 } 301 }
374 } 372 }
375 373
376 /* rc == NGX_AGAIN */ 374 /* rc == NGX_AGAIN */
377 375
378 ngx_add_timer(c->write, p->lcf->connect_timeout); 376 ngx_add_timer(c->write, p->lcf->connect_timeout);
379 c->write->timer_set = 1;
380 377
381 return; 378 return;
382 } 379 }
383 } 380 }
384 } 381 }
598 595
599 n = ngx_recv(p->upstream.connection, p->header_in->last, 596 n = ngx_recv(p->upstream.connection, p->header_in->last,
600 p->header_in->end - p->header_in->last); 597 p->header_in->end - p->header_in->last);
601 598
602 if (n == NGX_AGAIN) { 599 if (n == NGX_AGAIN) {
603 if (rev->timer_set) {
604 ngx_del_timer(rev);
605 } else {
606 rev->timer_set = 1;
607 }
608
609 ngx_add_timer(rev, p->lcf->read_timeout); 600 ngx_add_timer(rev, p->lcf->read_timeout);
610 601
611 if (!rev->active) { 602 if (ngx_handle_read_event(rev) == NGX_ERROR) {
612 if (ngx_event_flags & NGX_HAVE_CLEAR_EVENT) { 603 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
613 /* kqueue */ 604 return NGX_ERROR;
614 event = NGX_CLEAR_EVENT;
615
616 } else {
617 /* select, poll, /dev/poll */
618 event = NGX_LEVEL_EVENT;
619 }
620
621 if (ngx_add_event(rev, NGX_READ_EVENT, event) == NGX_ERROR) {
622 ngx_http_proxy_finalize_request(p,
623 NGX_HTTP_INTERNAL_SERVER_ERROR);
624 return NGX_ERROR;
625 }
626 } 605 }
627 606
628 return NGX_AGAIN; 607 return NGX_AGAIN;
629 } 608 }
630 609
1050 return; 1029 return;
1051 } 1030 }
1052 1031
1053 if (c->read->timer_set) { 1032 if (c->read->timer_set) {
1054 ngx_del_timer(c->read); 1033 ngx_del_timer(c->read);
1055 c->read->timer_set = 0;
1056 } 1034 }
1057 1035
1058 if (c->write->timer_set) { 1036 if (c->write->timer_set) {
1059 ngx_del_timer(c->write); 1037 ngx_del_timer(c->write);
1060 c->write->timer_set = 0;
1061 } 1038 }
1062 1039
1063 /* TODO: move connection to the connection pool */ 1040 /* TODO: move connection to the connection pool */
1064 1041
1065 if (ngx_del_conn) { 1042 if (ngx_del_conn) {