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

Eliminate the "DONE" state, it is now a session state.

parent a1e3ed99
...@@ -227,7 +227,7 @@ DOT DONE -> ESI_RESP ...@@ -227,7 +227,7 @@ DOT DONE -> ESI_RESP
*/ */
static int static int
cnt_done(struct sess *sp, struct worker *wrk, struct req *req) cnt_sess_done(struct sess *sp, struct worker *wrk, struct req *req)
{ {
double dh, dp, da; double dh, dp, da;
int i; int i;
...@@ -242,9 +242,7 @@ cnt_done(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -242,9 +242,7 @@ cnt_done(struct sess *sp, struct worker *wrk, struct req *req)
req->director = NULL; req->director = NULL;
req->restarts = 0; req->restarts = 0;
/* If we did an ESI include, don't mess up our state */ AZ(req->esi_level);
if (req->esi_level > 0)
return (1);
if (req->vcl != NULL) { if (req->vcl != NULL) {
if (wrk->vcl != NULL) if (wrk->vcl != NULL)
...@@ -343,7 +341,7 @@ CNT_Session(struct sess *sp) ...@@ -343,7 +341,7 @@ CNT_Session(struct sess *sp)
SES_Close(sp, "remote closed"); SES_Close(sp, "remote closed");
else else
SES_Close(sp, "error"); SES_Close(sp, "error");
assert(cnt_done(sp, wrk, sp->req) == 1); assert(cnt_sess_done(sp, wrk, sp->req) == 1);
return; return;
} }
...@@ -362,10 +360,7 @@ CNT_Session(struct sess *sp) ...@@ -362,10 +360,7 @@ CNT_Session(struct sess *sp)
if (done == 2) if (done == 2)
return; return;
assert(done == 1); assert(done == 1);
} done = cnt_sess_done(sp, wrk, sp->req);
if (sp->step == STP_DONE) {
done = cnt_done(sp, wrk, sp->req);
if (done) if (done)
return; return;
} }
...@@ -547,7 +542,6 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -547,7 +542,6 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
assert(WRW_IsReleased(wrk)); assert(WRW_IsReleased(wrk));
(void)HSH_Deref(&wrk->stats, NULL, &req->obj); (void)HSH_Deref(&wrk->stats, NULL, &req->obj);
http_Teardown(req->resp); http_Teardown(req->resp);
sp->step = STP_DONE;
return (1); return (1);
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
...@@ -594,7 +588,6 @@ cnt_error(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -594,7 +588,6 @@ cnt_error(struct sess *sp, struct worker *wrk, struct req *req)
req->director = NULL; req->director = NULL;
http_Teardown(bo->beresp); http_Teardown(bo->beresp);
http_Teardown(bo->bereq); http_Teardown(bo->bereq);
sp->step = STP_DONE;
return(1); return(1);
} }
CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
...@@ -1361,7 +1354,6 @@ cnt_pipe(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -1361,7 +1354,6 @@ cnt_pipe(struct sess *sp, struct worker *wrk, struct req *req)
assert(WRW_IsReleased(wrk)); assert(WRW_IsReleased(wrk));
http_Teardown(bo->bereq); http_Teardown(bo->bereq);
VBO_DerefBusyObj(wrk, &req->busyobj); VBO_DerefBusyObj(wrk, &req->busyobj);
sp->step = STP_DONE;
return (1); return (1);
} }
...@@ -1487,7 +1479,6 @@ cnt_recv(struct sess *sp, const struct worker *wrk, struct req *req) ...@@ -1487,7 +1479,6 @@ cnt_recv(struct sess *sp, const struct worker *wrk, struct req *req)
if (req->esi_level > 0) { if (req->esi_level > 0) {
/* XXX: VSL something */ /* XXX: VSL something */
INCOMPL(); INCOMPL();
/* sp->step = STP_DONE; */
return (1); return (1);
} }
sp->step = STP_PIPE; sp->step = STP_PIPE;
...@@ -1552,7 +1543,6 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -1552,7 +1543,6 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req)
/* If we could not even parse the request, just close */ /* If we could not even parse the request, just close */
if (req->err_code == 400) { if (req->err_code == 400) {
sp->step = STP_DONE;
SES_Close(sp, "junk"); SES_Close(sp, "junk");
return (1); return (1);
} }
...@@ -1569,7 +1559,6 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -1569,7 +1559,6 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req)
if (strcasecmp(p, "100-continue")) { if (strcasecmp(p, "100-continue")) {
req->err_code = 417; req->err_code = 417;
} else if (strlen(r) != write(sp->fd, r, strlen(r))) { } else if (strlen(r) != write(sp->fd, r, strlen(r))) {
sp->step = STP_DONE;
SES_Close(sp, "remote closed"); SES_Close(sp, "remote closed");
return (1); return (1);
} }
...@@ -1657,7 +1646,6 @@ CNT_Request(struct req *req) ...@@ -1657,7 +1646,6 @@ CNT_Request(struct req *req)
assert(req->sp == sp); assert(req->sp == sp);
assert(sp->step != STP_WAIT); assert(sp->step != STP_WAIT);
assert(sp->step != STP_DONE);
switch (sp->step) { switch (sp->step) {
#define SESS_STEP(l,u,arg) \ #define SESS_STEP(l,u,arg) \
......
...@@ -96,10 +96,8 @@ ved_include(struct req *req, const char *src, const char *host) ...@@ -96,10 +96,8 @@ ved_include(struct req *req, const char *src, const char *host)
while (1) { while (1) {
req->sp->wrk = wrk; req->sp->wrk = wrk;
i = CNT_Request(req); i = CNT_Request(req);
if (req->sp->step == STP_DONE) { if (i == 1)
assert(i == 1);
break; break;
}
assert(i == 2); assert(i == 2);
AZ(req->sp->wrk); AZ(req->sp->wrk);
DSL(0x20, SLT_Debug, req->sp->vsl_id, "loop waiting for ESI"); DSL(0x20, SLT_Debug, req->sp->vsl_id, "loop waiting for ESI");
...@@ -107,7 +105,6 @@ ved_include(struct req *req, const char *src, const char *host) ...@@ -107,7 +105,6 @@ ved_include(struct req *req, const char *src, const char *host)
} }
req->xid = sxid; req->xid = sxid;
AN(req->sp->wrk); AN(req->sp->wrk);
assert(req->sp->step == STP_DONE);
req->esi_level--; req->esi_level--;
req->obj = obj; req->obj = obj;
req->res_mode = res_mode; req->res_mode = res_mode;
......
...@@ -43,5 +43,4 @@ SESS_STEP(fetchbody, FETCHBODY, (sp, sp->wrk, sp->req)) ...@@ -43,5 +43,4 @@ SESS_STEP(fetchbody, FETCHBODY, (sp, sp->wrk, sp->req))
SESS_STEP(prepresp, PREPRESP, (sp, sp->wrk, sp->req)) SESS_STEP(prepresp, PREPRESP, (sp, sp->wrk, sp->req))
SESS_STEP(deliver, DELIVER, (sp, sp->wrk, sp->req)) SESS_STEP(deliver, DELIVER, (sp, sp->wrk, sp->req))
SESS_STEP(error, ERROR, (sp, sp->wrk, sp->req)) SESS_STEP(error, ERROR, (sp, sp->wrk, sp->req))
SESS_STEP(done, DONE, (sp, sp->wrk, sp->req))
/*lint -restore */ /*lint -restore */
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