[master] 5011af2 Add some asserts to narrow #1147 and #1148 down
Poul-Henning Kamp
phk at varnish-cache.org
Mon Jun 4 11:33:24 CEST 2012
commit 5011af25e862e25cdd86c046b7a0c9ed77df115c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jun 4 09:33:06 2012 +0000
Add some asserts to narrow #1147 and #1148 down
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 21f5939..5ec3752 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -116,6 +116,7 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
SES_GetReq(sp);
req = sp->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ assert(req->sp == sp);
HTC_Init(req->htc, req->ws, sp->fd, sp->req->vsl,
cache_param->http_req_size,
cache_param->http_req_hdr_len);
@@ -928,6 +929,7 @@ DOT first -> wait [style=bold,color=green]
static int
cnt_first(struct sess *sp, struct worker *wrk)
{
+ struct req *req;
char laddr[ADDR_BUFSIZE];
char lport[PORT_BUFSIZE];
@@ -936,8 +938,10 @@ cnt_first(struct sess *sp, struct worker *wrk)
/* Allocate a request already now, so we can VSL to it */
SES_GetReq(sp);
- CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC);
- HTC_Init(sp->req->htc, sp->req->ws, sp->fd, sp->req->vsl,
+ req = sp->req;
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ assert(req->sp == sp);
+ HTC_Init(req->htc, req->ws, sp->fd, req->vsl,
cache_param->http_req_size,
cache_param->http_req_hdr_len);
@@ -949,11 +953,11 @@ cnt_first(struct sess *sp, struct worker *wrk)
VTCP_name(&sp->mysockaddr, sp->mysockaddrlen,
laddr, sizeof laddr, lport, sizeof lport);
/* XXX: have no req yet */
- VSLb(sp->req->vsl, SLT_SessionOpen, "%s %s %s %s",
+ VSLb(req->vsl, SLT_SessionOpen, "%s %s %s %s",
sp->addr, sp->port, laddr, lport);
} else {
/* XXX: have no req yet */
- VSLb(sp->req->vsl, SLT_SessionOpen, "%s %s %s",
+ VSLb(req->vsl, SLT_SessionOpen, "%s %s %s",
sp->addr, sp->port, sp->mylsock->name);
}
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 43ef3cd..9cdf427 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -338,6 +338,8 @@ void \
VCL_##func##_method(struct req *req) \
{ \
\
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \
+ CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); \
req->handling = 0; \
req->cur_method = VCL_MET_ ## upper; \
VSLb(req->vsl, SLT_VCL_call, "%s", #func); \
More information about the varnish-commit
mailing list