Commit b5ee5e68 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Handle worker thread on subrequests correctly



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3801 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e01b312d
...@@ -759,22 +759,24 @@ ESI_Deliver(struct sess *sp) ...@@ -759,22 +759,24 @@ ESI_Deliver(struct sess *sp)
{ {
struct esi_bit *eb; struct esi_bit *eb;
struct object *obj; 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) { VTAILQ_FOREACH(eb, &sp->obj->esibits, list) {
if (Tlen(eb->verbatim)) { if (Tlen(eb->verbatim)) {
if (sp->http->protover >= 1.1) if (sp->http->protover >= 1.1)
(void)WRW_Write(sp->wrk, eb->chunk_length, -1); (void)WRW_Write(w, eb->chunk_length, -1);
sp->acct_req.bodybytes += WRW_Write(sp->wrk, sp->acct_req.bodybytes += WRW_Write(w,
eb->verbatim.b, Tlen(eb->verbatim)); eb->verbatim.b, Tlen(eb->verbatim));
if (sp->http->protover >= 1.1) 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 || if (eb->include.b == NULL ||
sp->esis >= params->max_esi_includes) sp->esis >= params->max_esi_includes)
continue; continue;
if (WRW_FlushRelease(sp->wrk)) { if (WRW_FlushRelease(w)) {
vca_close_session(sp, "remote closed"); vca_close_session(sp, "remote closed");
return; return;
} }
...@@ -788,7 +790,7 @@ ESI_Deliver(struct sess *sp) ...@@ -788,7 +790,7 @@ ESI_Deliver(struct sess *sp)
if (eb->host.b != NULL) { if (eb->host.b != NULL) {
http_Unset(sp->http, H_Host); http_Unset(sp->http, H_Host);
http_Unset(sp->http, H_If_Modified_Since); 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 * XXX: We should decide if we should cache the director
...@@ -807,14 +809,16 @@ ESI_Deliver(struct sess *sp) ...@@ -807,14 +809,16 @@ ESI_Deliver(struct sess *sp)
http_Unset(sp->http, H_Content_Length); http_Unset(sp->http, H_Content_Length);
while (1) { while (1) {
sp->wrk = w;
CNT_Session(sp); CNT_Session(sp);
if (sp->step == STP_DONE) if (sp->step == STP_DONE)
break; break;
AN(sp->wrk); AZ(sp->wrk);
WSL_Flush(sp->wrk, 0); WSL_Flush(w, 0);
DSL(0x20, SLT_Debug, sp->id, "loop waiting for ESI"); DSL(0x20, SLT_Debug, sp->id, "loop waiting for ESI");
(void)usleep(10000); (void)usleep(10000);
} }
AN(sp->wrk);
assert(sp->step == STP_DONE); assert(sp->step == STP_DONE);
sp->esis--; sp->esis--;
sp->obj = obj; sp->obj = obj;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment