comparison src/http/ngx_http_upstream_round_robin.c @ 5136:88a302caca75

Upstream: removed rudiments of upstream connection caching. This functionality is now provided by ngx_http_upstream_keepalive_module.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 25 Mar 2013 14:51:44 +0000
parents 0811376954e4
children 1d68b502088c
comparison
equal deleted inserted replaced
5135:0811376954e4 5136:88a302caca75
371 { 371 {
372 ngx_http_upstream_rr_peer_data_t *rrp = data; 372 ngx_http_upstream_rr_peer_data_t *rrp = data;
373 373
374 ngx_int_t rc; 374 ngx_int_t rc;
375 ngx_uint_t i, n; 375 ngx_uint_t i, n;
376 ngx_connection_t *c;
377 ngx_http_upstream_rr_peer_t *peer; 376 ngx_http_upstream_rr_peer_t *peer;
378 ngx_http_upstream_rr_peers_t *peers; 377 ngx_http_upstream_rr_peers_t *peers;
379 378
380 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, 379 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
381 "get rr peer, try: %ui", pc->tries); 380 "get rr peer, try: %ui", pc->tries);
382 381
383 /* ngx_lock_mutex(rrp->peers->mutex); */ 382 /* ngx_lock_mutex(rrp->peers->mutex); */
384
385 if (rrp->peers->last_cached) {
386
387 /* cached connection */
388
389 c = rrp->peers->cached[rrp->peers->last_cached];
390 rrp->peers->last_cached--;
391
392 /* ngx_unlock_mutex(ppr->peers->mutex); */
393
394 #if (NGX_THREADS)
395 c->read->lock = c->read->own_lock;
396 c->write->lock = c->write->own_lock;
397 #endif
398
399 pc->connection = c;
400 pc->cached = 1;
401
402 return NGX_OK;
403 }
404 383
405 pc->cached = 0; 384 pc->cached = 0;
406 pc->connection = NULL; 385 pc->connection = NULL;
407 386
408 if (rrp->peers->single) { 387 if (rrp->peers->single) {