[experimental-ims] cf811a3 Give struct req a back pointer to struct sess
Poul-Henning Kamp
phk at FreeBSD.org
Thu Dec 18 10:27:47 CET 2014
commit cf811a3e0461e4c0112ad9906a12004bfb28b88b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue May 29 06:38:37 2012 +0000
Give struct req a back pointer to struct sess
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index ee17d31..93e05e7 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -561,6 +561,8 @@ struct req {
uint8_t hash_ignore_busy;
uint8_t hash_always_miss;
+ struct sess *sp;
+
/* The busy objhead we sleep on */
struct objhead *hash_objhead;
struct busyobj *busyobj;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index ba52ad3..3a85baf 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -291,6 +291,7 @@ void
SES_GetReq(struct sess *sp)
{
struct sesspool *pp;
+ struct req *req;
uint16_t nhttp;
unsigned sz, hl;
char *p, *e;
@@ -301,42 +302,44 @@ SES_GetReq(struct sess *sp)
AN(pp->pool);
AZ(sp->req);
- sp->req = MPL_Get(pp->mpl_req, &sz);
- AN(sp->req);
- sp->req->magic = REQ_MAGIC;
-
- e = (char*)sp->req + sz;
- p = (char*)(sp->req + 1);
+ req = MPL_Get(pp->mpl_req, &sz);
+ AN(req);
+ req->magic = REQ_MAGIC;
+ sp->req = req;
+ req->sp = sp;
+
+ e = (char*)req + sz;
+ p = (char*)(req + 1);
p = (void*)PRNDUP(p);
assert(p < e);
nhttp = (uint16_t)cache_param->http_max_hdr;
hl = HTTP_estimate(nhttp);
- sp->req->http = HTTP_create(p, nhttp);
+ req->http = HTTP_create(p, nhttp);
p += hl;
p = (void*)PRNDUP(p);
assert(p < e);
- sp->req->http0 = HTTP_create(p, nhttp);
+ req->http0 = HTTP_create(p, nhttp);
p += hl;
p = (void*)PRNDUP(p);
assert(p < e);
- sp->req->resp = HTTP_create(p, nhttp);
+ req->resp = HTTP_create(p, nhttp);
p += hl;
p = (void*)PRNDUP(p);
assert(p < e);
sz = cache_param->workspace_thread;
- VSL_Setup(sp->req->vsl, p, sz);
- sp->req->vsl->wid = sp->vsl_id;
+ VSL_Setup(req->vsl, p, sz);
+ req->vsl->wid = sp->vsl_id;
p += sz;
p = (void*)PRNDUP(p);
assert(p < e);
- WS_Init(sp->req->ws, "req", p, e - p);
+ WS_Init(req->ws, "req", p, e - p);
}
void
@@ -352,6 +355,7 @@ SES_ReleaseReq(struct sess *sp)
MPL_AssertSane(sp->req);
VSL_Flush(sp->req->vsl, 0);
MPL_Free(pp->mpl_req, sp->req);
+ sp->req->sp = NULL;
sp->req = NULL;
}
More information about the varnish-commit
mailing list