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

Add more asserts to nail #1147

parent e75cd2e6
......@@ -268,7 +268,9 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
HTTP_Setup(req->resp, req->ws, req->vsl, HTTP_Resp);
RES_BuildHttp(sp);
assert(req->sp == sp);
VCL_deliver_method(req);
assert(req->sp == sp);
switch (req->handling) {
case VCL_RET_DELIVER:
break;
......@@ -523,7 +525,9 @@ cnt_error(struct sess *sp, struct worker *wrk, struct req *req)
http_PutResponse(h, req->err_reason);
else
http_PutResponse(h, http_StatusMessage(req->err_code));
assert(req->sp == sp);
VCL_error_method(req);
assert(req->sp == sp);
if (req->handling == VCL_RET_RESTART &&
req->restarts < cache_param->max_restarts) {
......@@ -632,7 +636,9 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
AZ(bo->do_esi);
AZ(bo->do_pass);
assert(req->sp == sp);
VCL_fetch_method(req);
assert(req->sp == sp);
if (bo->do_pass)
req->objcore->flags |= OC_F_PASS;
......@@ -1001,7 +1007,9 @@ cnt_hit(struct sess *sp, struct worker *wrk, struct req *req)
assert(!(req->obj->objcore->flags & OC_F_PASS));
assert(req->sp == sp);
VCL_hit_method(req);
assert(req->sp == sp);
if (req->handling == VCL_RET_DELIVER) {
//AZ(req->busyobj->bereq->ws);
......@@ -1175,7 +1183,9 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
http_SetHeader(bo->bereq, "Accept-Encoding: gzip");
}
assert(req->sp == sp);
VCL_miss_method(req);
assert(req->sp == sp);
if (req->handling == VCL_RET_FETCH) {
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
......@@ -1241,7 +1251,9 @@ cnt_pass(struct sess *sp, struct worker *wrk, struct req *req)
HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
http_FilterReq(sp, HTTPH_R_PASS);
assert(req->sp == sp);
VCL_pass_method(req);
assert(req->sp == sp);
if (req->handling == VCL_RET_ERROR) {
http_Teardown(bo->bereq);
......@@ -1301,7 +1313,9 @@ cnt_pipe(struct sess *sp, struct worker *wrk, struct req *req)
HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
http_FilterReq(sp, 0);
assert(req->sp == sp);
VCL_pipe_method(req);
assert(req->sp == sp);
if (req->handling == VCL_RET_ERROR)
INCOMPL();
......@@ -1399,7 +1413,9 @@ cnt_recv(struct sess *sp, const struct worker *wrk, struct req *req)
http_CollectHdr(req->http, H_Cache_Control);
assert(req->sp == sp);
VCL_recv_method(req);
assert(req->sp == sp);
recv_handling = req->handling;
if (cache_param->http_gzip_support &&
......@@ -1415,7 +1431,9 @@ cnt_recv(struct sess *sp, const struct worker *wrk, struct req *req)
req->sha256ctx = &sha256ctx; /* so HSH_AddString() can find it */
SHA256_Init(req->sha256ctx);
assert(req->sp == sp);
VCL_hash_method(req);
assert(req->sp == sp);
assert(req->handling == VCL_RET_HASH);
SHA256_Final(req->digest, req->sha256ctx);
req->sha256ctx = NULL;
......@@ -1616,6 +1634,12 @@ CNT_Session(struct sess *sp)
CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
WS_Assert(wrk->aws);
if (sp->req != NULL) {
CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC);
AN(sp->req->sp);
assert(sp->req->sp == sp);
}
switch (sp->step) {
#define STEP(l,u,arg) \
case STP_##u: \
......
......@@ -352,6 +352,8 @@ SES_ReleaseReq(struct sess *sp)
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
AN(pp->pool);
CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC);
AN(sp->req->sp);
assert(sp->req->sp == sp);
MPL_AssertSane(sp->req);
VSL_Flush(sp->req->vsl, 0);
MPL_Free(pp->mpl_req, sp->req);
......
......@@ -340,6 +340,7 @@ VCL_##func##_method(struct req *req) \
\
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \
CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); \
AN(req->sp); \
req->handling = 0; \
req->cur_method = VCL_MET_ ## upper; \
VSLb(req->vsl, SLT_VCL_call, "%s", #func); \
......
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