Mercurial > hg > nginx
comparison src/http/modules/ngx_http_memcached_module.c @ 4121:16c60162c35b
Keepalive support in memcached.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 15 Sep 2011 19:04:25 +0000 |
parents | dbddec65fdab |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
4120:42135dd1f0ea | 4121:16c60162c35b |
---|---|
364 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 364 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
365 "key: \"%V\" was not found by memcached", &ctx->key); | 365 "key: \"%V\" was not found by memcached", &ctx->key); |
366 | 366 |
367 u->headers_in.status_n = 404; | 367 u->headers_in.status_n = 404; |
368 u->state->status = 404; | 368 u->state->status = 404; |
369 u->keepalive = 1; | |
369 | 370 |
370 return NGX_OK; | 371 return NGX_OK; |
371 } | 372 } |
372 | 373 |
373 no_valid: | 374 no_valid: |
424 } | 425 } |
425 | 426 |
426 u->length -= bytes; | 427 u->length -= bytes; |
427 ctx->rest -= bytes; | 428 ctx->rest -= bytes; |
428 | 429 |
430 if (u->length == 0) { | |
431 u->keepalive = 1; | |
432 } | |
433 | |
429 return NGX_OK; | 434 return NGX_OK; |
430 } | 435 } |
431 | 436 |
432 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { | 437 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { |
433 ll = &cl->next; | 438 ll = &cl->next; |
461 last += u->length - NGX_HTTP_MEMCACHED_END; | 466 last += u->length - NGX_HTTP_MEMCACHED_END; |
462 | 467 |
463 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) { | 468 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) { |
464 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, | 469 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, |
465 "memcached sent invalid trailer"); | 470 "memcached sent invalid trailer"); |
471 | |
472 b->last = last; | |
473 cl->buf->last = last; | |
474 u->length = 0; | |
475 ctx->rest = 0; | |
476 | |
477 return NGX_OK; | |
466 } | 478 } |
467 | 479 |
468 ctx->rest -= b->last - last; | 480 ctx->rest -= b->last - last; |
469 b->last = last; | 481 b->last = last; |
470 cl->buf->last = last; | 482 cl->buf->last = last; |
471 u->length = ctx->rest; | 483 u->length = ctx->rest; |
484 | |
485 if (u->length == 0) { | |
486 u->keepalive = 1; | |
487 } | |
472 | 488 |
473 return NGX_OK; | 489 return NGX_OK; |
474 } | 490 } |
475 | 491 |
476 | 492 |