From 7a47dbd54a118216eaea2642412041ada7d98f40 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 20 Feb 2009 18:41:57 +0000 Subject: [PATCH] Handle worker thread on subrequests correctly git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3801 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vrt_esi.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_vrt_esi.c b/varnish-cache/bin/varnishd/cache_vrt_esi.c index 74ebbd02..b6af0a35 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_esi.c +++ b/varnish-cache/bin/varnishd/cache_vrt_esi.c @@ -759,22 +759,24 @@ ESI_Deliver(struct sess *sp) { struct esi_bit *eb; struct object *obj; + struct worker *w; - WRW_Reserve(sp->wrk, &sp->fd); + w = sp->wrk; + WRW_Reserve(w, &sp->fd); VTAILQ_FOREACH(eb, &sp->obj->esibits, list) { if (Tlen(eb->verbatim)) { if (sp->http->protover >= 1.1) - (void)WRW_Write(sp->wrk, eb->chunk_length, -1); - sp->acct_req.bodybytes += WRW_Write(sp->wrk, + (void)WRW_Write(w, eb->chunk_length, -1); + sp->acct_req.bodybytes += WRW_Write(w, eb->verbatim.b, Tlen(eb->verbatim)); if (sp->http->protover >= 1.1) - (void)WRW_Write(sp->wrk, "\r\n", -1); + (void)WRW_Write(w, "\r\n", -1); } if (eb->include.b == NULL || sp->esis >= params->max_esi_includes) continue; - if (WRW_FlushRelease(sp->wrk)) { + if (WRW_FlushRelease(w)) { vca_close_session(sp, "remote closed"); return; } @@ -788,7 +790,7 @@ ESI_Deliver(struct sess *sp) if (eb->host.b != NULL) { http_Unset(sp->http, H_Host); http_Unset(sp->http, H_If_Modified_Since); - http_SetHeader(sp->wrk, sp->fd, sp->http, eb->host.b); + http_SetHeader(w, sp->fd, sp->http, eb->host.b); } /* * XXX: We should decide if we should cache the director @@ -807,14 +809,16 @@ ESI_Deliver(struct sess *sp) http_Unset(sp->http, H_Content_Length); while (1) { + sp->wrk = w; CNT_Session(sp); if (sp->step == STP_DONE) break; - AN(sp->wrk); - WSL_Flush(sp->wrk, 0); + AZ(sp->wrk); + WSL_Flush(w, 0); DSL(0x20, SLT_Debug, sp->id, "loop waiting for ESI"); (void)usleep(10000); } + AN(sp->wrk); assert(sp->step == STP_DONE); sp->esis--; sp->obj = obj; -- 2.39.5