Mercurial > hg > ngx_http_upstream_keepalive
comparison ngx_http_upstream_keepalive_module.c @ 33:52ca695446d3
Keepalive: more connection validity checks.
Make sure to not cache connections with errors detected, as well as EOF
already read or pending data present. Call ngx_handle_read_event() for
event methods which need it.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 31 Aug 2011 21:21:14 +0400 |
parents | 9aa0d263f2a7 |
children | 4574b97220fb |
comparison
equal
deleted
inserted
replaced
32:9aa0d263f2a7 | 33:52ca695446d3 |
---|---|
335 u = kp->upstream; | 335 u = kp->upstream; |
336 c = pc->connection; | 336 c = pc->connection; |
337 | 337 |
338 if (kp->failed | 338 if (kp->failed |
339 || c == NULL | 339 || c == NULL |
340 || c->read->eof | |
341 || c->read->ready | |
342 || c->read->error | |
340 || c->read->timedout | 343 || c->read->timedout |
344 || c->write->error | |
341 || c->write->timedout) | 345 || c->write->timedout) |
342 { | 346 { |
343 goto invalid; | 347 goto invalid; |
344 } | 348 } |
345 | 349 |
367 if (c->ssl) { | 371 if (c->ssl) { |
368 goto invalid; | 372 goto invalid; |
369 } | 373 } |
370 | 374 |
371 #endif | 375 #endif |
376 | |
377 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { | |
378 goto invalid; | |
379 } | |
372 | 380 |
373 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, | 381 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
374 "free keepalive peer: saving connection %p", c); | 382 "free keepalive peer: saving connection %p", c); |
375 | 383 |
376 if (ngx_queue_empty(&kp->conf->free)) { | 384 if (ngx_queue_empty(&kp->conf->free)) { |