[master] 3abbb12 Move another 56 bytes from sess to req
Poul-Henning Kamp
phk at varnish-cache.org
Fri Dec 23 13:30:37 CET 2011
commit 3abbb1270c6cdfd2511ddca4f316c98e7353efd7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Dec 23 12:30:26 2011 +0000
Move another 56 bytes from sess to req
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 1b2f1a7..578d548 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -605,6 +605,16 @@ struct req {
unsigned char sendbody;
unsigned char wantbody;
+ uint16_t err_code;
+ const char *err_reason;
+
+ struct director *director;
+ struct VCL_conf *vcl;
+
+ uint64_t req_bodybytes;
+ char *ws_req; /* WS above request data */
+
+ double t_resp;
};
/*--------------------------------------------------------------------*/
@@ -656,19 +666,9 @@ struct sess {
struct http *http0;
struct ws ws[1];
- char *ws_req; /* WS above request data */
-
- uint16_t err_code;
- const char *err_reason;
-
- struct director *director;
- struct VCL_conf *vcl;
-
- uint64_t req_bodybytes;
/* Timestamps, all on TIM_real() timescale */
double t_req;
- double t_resp;
/* TBD fields ------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 48c01a3..0b3c261 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -348,7 +348,7 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
/* XXX locking of stats */
VSC_C_main->backend_reuse += 1;
WSP(sp, SLT_Backend, "%d %s %s",
- vc->fd, sp->director->vcl_name, bp->display_name);
+ vc->fd, sp->req->director->vcl_name, bp->display_name);
vc->vdis = vs;
vc->recycled = 1;
return (vc);
@@ -390,7 +390,7 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
vc->backend = bp;
VSC_C_main->backend_conn++;
WSP(sp, SLT_Backend, "%d %s %s",
- vc->fd, sp->director->vcl_name, bp->display_name);
+ vc->fd, sp->req->director->vcl_name, bp->display_name);
vc->vdis = vs;
return (vc);
}
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index cb5d161..6eef7cb 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -110,10 +110,11 @@ cnt_wait(struct sess *sp)
if (sp->req == NULL)
SES_GetReq(sp);
- AZ(sp->vcl);
+ AZ(sp->req->vcl);
AZ(wrk->obj);
AZ(sp->req->esi_level);
assert(sp->req->xid == 0);
+ sp->req->t_resp = NAN;
assert(!isnan(sp->t_req));
tmo = (int)(1e3 * cache_param->timeout_linger);
@@ -210,7 +211,7 @@ cnt_prepresp(struct sess *sp)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(wrk->obj, OBJECT_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
if (wrk->busyobj != NULL) {
CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
@@ -268,13 +269,13 @@ cnt_prepresp(struct sess *sp)
}
}
- sp->t_resp = W_TIM_real(wrk);
+ sp->req->t_resp = W_TIM_real(wrk);
if (wrk->obj->objcore != NULL) {
- if ((sp->t_resp - wrk->obj->last_lru) >
+ if ((sp->req->t_resp - wrk->obj->last_lru) >
cache_param->lru_timeout &&
EXP_Touch(wrk->obj->objcore))
- wrk->obj->last_lru = sp->t_resp;
- wrk->obj->last_use = sp->t_resp; /* XXX: locking ? */
+ wrk->obj->last_lru = sp->req->t_resp;
+ wrk->obj->last_use = sp->req->t_resp; /* XXX: locking ? */
}
http_Setup(wrk->resp, wrk->ws);
RES_BuildHttp(sp);
@@ -295,7 +296,7 @@ cnt_prepresp(struct sess *sp)
}
AZ(wrk->obj);
sp->req->restarts++;
- sp->director = NULL;
+ sp->req->director = NULL;
http_Setup(wrk->resp, NULL);
sp->step = STP_RECV;
return (0);
@@ -336,7 +337,7 @@ cnt_deliver(struct sess *sp)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AZ(sp->wrk->busyobj);
- sp->director = NULL;
+ sp->req->director = NULL;
sp->req->restarts = 0;
RES_WriteObj(sp);
@@ -373,11 +374,11 @@ cnt_done(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_ORNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_ORNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->obj);
AZ(wrk->busyobj);
- sp->director = NULL;
+ sp->req->director = NULL;
sp->req->restarts = 0;
wrk->busyobj = NULL;
@@ -388,26 +389,26 @@ cnt_done(struct sess *sp)
if (sp->req->esi_level > 0)
return (1);
- if (sp->vcl != NULL) {
+ if (sp->req->vcl != NULL) {
if (wrk->vcl != NULL)
VCL_Rel(&wrk->vcl);
- wrk->vcl = sp->vcl;
- sp->vcl = NULL;
+ wrk->vcl = sp->req->vcl;
+ sp->req->vcl = NULL;
}
sp->t_idle = W_TIM_real(wrk);
if (sp->req->xid == 0) {
- sp->t_resp = sp->t_idle;
+ sp->req->t_resp = sp->t_idle;
} else {
- dp = sp->t_resp - sp->t_req;
- da = sp->t_idle - sp->t_resp;
+ dp = sp->req->t_resp - sp->t_req;
+ da = sp->t_idle - sp->req->t_resp;
dh = sp->t_req - sp->t_open;
/* XXX: Add StatReq == StatSess */
/* XXX: Workaround for pipe */
if (sp->fd >= 0) {
WSP(sp, SLT_Length, "%ju",
- (uintmax_t)sp->req_bodybytes);
+ (uintmax_t)sp->req->req_bodybytes);
}
WSP(sp, SLT_ReqEnd, "%u %.9f %.9f %.9f %.9f %.9f",
sp->req->xid, sp->t_req, sp->t_idle, dh, dp, da);
@@ -416,9 +417,9 @@ cnt_done(struct sess *sp)
WSL_Flush(wrk, 0);
sp->t_req = NAN;
- sp->t_resp = NAN;
+ sp->req->t_resp = NAN;
- sp->req_bodybytes = 0;
+ sp->req->req_bodybytes = 0;
sp->req->hash_always_miss = 0;
sp->req->hash_ignore_busy = 0;
@@ -496,7 +497,7 @@ cnt_error(struct sess *sp)
(uint16_t)cache_param->http_max_hdr);
if (wrk->obj == NULL) {
sp->req->doclose = "Out of objects";
- sp->director = NULL;
+ sp->req->director = NULL;
http_Setup(wrk->busyobj->beresp, NULL);
http_Setup(wrk->busyobj->bereq, NULL);
sp->step = STP_DONE;
@@ -512,27 +513,27 @@ cnt_error(struct sess *sp)
CHECK_OBJ_NOTNULL(wrk->obj, OBJECT_MAGIC);
h = wrk->obj->http;
- if (sp->err_code < 100 || sp->err_code > 999)
- sp->err_code = 501;
+ if (sp->req->err_code < 100 || sp->req->err_code > 999)
+ sp->req->err_code = 501;
http_PutProtocol(wrk, sp->vsl_id, h, "HTTP/1.1");
- http_PutStatus(h, sp->err_code);
+ http_PutStatus(h, sp->req->err_code);
VTIM_format(W_TIM_real(wrk), date);
http_PrintfHeader(wrk, sp->vsl_id, h, "Date: %s", date);
http_SetHeader(wrk, sp->vsl_id, h, "Server: Varnish");
- if (sp->err_reason != NULL)
- http_PutResponse(wrk, sp->vsl_id, h, sp->err_reason);
+ if (sp->req->err_reason != NULL)
+ http_PutResponse(wrk, sp->vsl_id, h, sp->req->err_reason);
else
http_PutResponse(wrk, sp->vsl_id, h,
- http_StatusMessage(sp->err_code));
+ http_StatusMessage(sp->req->err_code));
VCL_error_method(sp);
if (sp->req->handling == VCL_RET_RESTART &&
sp->req->restarts < cache_param->max_restarts) {
HSH_Drop(wrk);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
- sp->director = NULL;
+ sp->req->director = NULL;
sp->req->restarts++;
sp->step = STP_RECV;
return (0);
@@ -545,8 +546,8 @@ cnt_error(struct sess *sp)
sp->req->wantbody = 1;
assert(sp->req->handling == VCL_RET_DELIVER);
- sp->err_code = 0;
- sp->err_reason = NULL;
+ sp->req->err_code = 0;
+ sp->req->err_reason = NULL;
http_Setup(wrk->busyobj->bereq, NULL);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
sp->step = STP_PREPRESP;
@@ -592,10 +593,10 @@ cnt_fetch(struct sess *sp)
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
- AN(sp->director);
+ AN(sp->req->director);
AZ(wrk->busyobj->vbc);
AZ(wrk->busyobj->should_close);
AZ(wrk->storage_hint);
@@ -617,7 +618,7 @@ cnt_fetch(struct sess *sp)
if (i) {
sp->req->handling = VCL_RET_ERROR;
- sp->err_code = 503;
+ sp->req->err_code = 503;
} else {
/*
* These two headers can be spread over multiple actual headers
@@ -634,7 +635,7 @@ cnt_fetch(struct sess *sp)
*/
wrk->busyobj->body_status = RFC2616_Body(sp);
- sp->err_code = http_GetStatus(wrk->busyobj->beresp);
+ sp->req->err_code = http_GetStatus(wrk->busyobj->beresp);
/*
* What does RFC2616 think about TTL ?
@@ -678,7 +679,7 @@ cnt_fetch(struct sess *sp)
wrk->objcore = NULL;
}
VBO_DerefBusyObj(wrk, &wrk->busyobj);
- sp->director = NULL;
+ sp->req->director = NULL;
wrk->storage_hint = NULL;
switch (sp->req->handling) {
@@ -847,7 +848,7 @@ cnt_fetchbody(struct sess *sp)
wrk->busyobj->exp.keep = 0.0;
}
if (wrk->obj == NULL) {
- sp->err_code = 503;
+ sp->req->err_code = 503;
sp->step = STP_ERROR;
VDI_CloseFd(wrk, &wrk->busyobj->vbc);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
@@ -870,7 +871,7 @@ cnt_fetchbody(struct sess *sp)
}
wrk->obj->xid = sp->req->xid;
- wrk->obj->response = sp->err_code;
+ wrk->obj->response = sp->req->err_code;
WS_Assert(wrk->obj->ws_o);
/* Filter into object */
@@ -915,13 +916,13 @@ cnt_fetchbody(struct sess *sp)
wrk->busyobj->vfp = NULL;
assert(WRW_IsReleased(wrk));
AZ(wrk->busyobj->vbc);
- AN(sp->director);
+ AN(sp->req->director);
if (i) {
HSH_Drop(wrk);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
AZ(wrk->obj);
- sp->err_code = 503;
+ sp->req->err_code = 503;
sp->step = STP_ERROR;
return (0);
}
@@ -984,7 +985,7 @@ cnt_streambody(struct sess *sp)
http_Setup(wrk->busyobj->beresp, NULL);
wrk->busyobj->vfp = NULL;
AZ(wrk->busyobj->vbc);
- AN(sp->director);
+ AN(sp->req->director);
if (!i && wrk->obj->objcore != NULL) {
EXP_Insert(wrk->obj);
@@ -995,7 +996,7 @@ cnt_streambody(struct sess *sp)
sp->req->doclose = "Stream error";
}
wrk->acct_tmp.fetch++;
- sp->director = NULL;
+ sp->req->director = NULL;
sp->req->restarts = 0;
RES_StreamEnd(sp);
@@ -1089,7 +1090,7 @@ cnt_hit(struct sess *sp)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(wrk->obj, OBJECT_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->busyobj);
assert(!(wrk->obj->objcore->flags & OC_F_PASS));
@@ -1117,7 +1118,7 @@ cnt_hit(struct sess *sp)
sp->step = STP_ERROR;
return (0);
case VCL_RET_RESTART:
- sp->director = NULL;
+ sp->req->director = NULL;
sp->req->restarts++;
sp->step = STP_RECV;
return (0);
@@ -1166,7 +1167,7 @@ cnt_lookup(struct sess *sp)
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->busyobj);
if (sp->req->hash_objhead == NULL) {
@@ -1275,7 +1276,7 @@ cnt_miss(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->obj);
AN(wrk->objcore);
@@ -1369,7 +1370,7 @@ cnt_pass(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->obj);
AZ(wrk->busyobj);
@@ -1429,7 +1430,7 @@ cnt_pipe(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->busyobj);
wrk->acct_tmp.pipe++;
@@ -1482,15 +1483,15 @@ cnt_recv(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
wrk = sp->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->vcl, VCL_CONF_MAGIC);
AZ(wrk->obj);
AZ(wrk->busyobj);
assert(wrk->wrw.ciov == wrk->wrw.siov);
/* By default we use the first backend */
- AZ(sp->director);
- sp->director = sp->vcl->director[0];
- AN(sp->director);
+ AZ(sp->req->director);
+ sp->req->director = sp->req->vcl->director[0];
+ AN(sp->req->director);
sp->req->disable_esi = 0;
sp->req->hash_always_miss = 0;
@@ -1503,8 +1504,8 @@ cnt_recv(struct sess *sp)
recv_handling = sp->req->handling;
if (sp->req->restarts >= cache_param->max_restarts) {
- if (sp->err_code == 0)
- sp->err_code = 503;
+ if (sp->req->err_code == 0)
+ sp->req->err_code = 503;
sp->step = STP_ERROR;
return (0);
}
@@ -1584,7 +1585,7 @@ cnt_start(struct sess *sp)
CHECK_OBJ_NOTNULL(sp->req, REQ_MAGIC);
AZ(sp->req->restarts);
AZ(wrk->obj);
- AZ(sp->vcl);
+ AZ(sp->req->vcl);
EXP_Clr(&sp->req->exp);
AZ(sp->req->esi_level);
@@ -1599,7 +1600,7 @@ cnt_start(struct sess *sp)
/* Borrow VCL reference from worker thread */
VCL_Refresh(&wrk->vcl);
- sp->vcl = wrk->vcl;
+ sp->req->vcl = wrk->vcl;
wrk->vcl = NULL;
http_Setup(sp->http, sp->ws);
@@ -1613,13 +1614,13 @@ cnt_start(struct sess *sp)
}
/* Catch request snapshot */
- sp->ws_req = WS_Snapshot(sp->ws);
+ sp->req->ws_req = WS_Snapshot(sp->ws);
/* Catch original request, before modification */
HTTP_Copy(sp->http0, sp->http);
if (done != 0) {
- sp->err_code = done;
+ sp->req->err_code = done;
sp->step = STP_ERROR;
return (0);
}
@@ -1633,7 +1634,7 @@ cnt_start(struct sess *sp)
*/
if (http_GetHdr(sp->http, H_Expect, &p)) {
if (strcasecmp(p, "100-continue")) {
- sp->err_code = 417;
+ sp->req->err_code = 417;
sp->step = STP_ERROR;
return (0);
}
@@ -1661,14 +1662,21 @@ cnt_start(struct sess *sp)
static void
cnt_diag(struct sess *sp, const char *state)
{
+ void *vcl;
+
+ if (sp->req == NULL)
+ vcl = NULL;
+ else
+ vcl = sp->req->vcl;
+
if (sp->wrk != NULL) {
WSP(sp, SLT_Debug, "thr %p STP_%s sp %p obj %p vcl %p",
- pthread_self(), state, sp, sp->wrk->obj, sp->vcl);
+ pthread_self(), state, sp, sp->wrk->obj, vcl);
WSL_Flush(sp->wrk, 0);
} else {
VSL(SLT_Debug, sp->vsl_id,
"thr %p STP_%s sp %p obj %p vcl %p",
- pthread_self(), state, sp, sp->wrk->obj, sp->vcl);
+ pthread_self(), state, sp, sp->wrk->obj, vcl);
}
}
diff --git a/bin/varnishd/cache/cache_dir.c b/bin/varnishd/cache/cache_dir.c
index 5902ce8..4ec81fb 100644
--- a/bin/varnishd/cache/cache_dir.c
+++ b/bin/varnishd/cache/cache_dir.c
@@ -105,7 +105,7 @@ VDI_GetFd(const struct director *d, struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
if (d == NULL)
- d = sp->director;
+ d = sp->req->director;
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
return (d->getfd(d, sp));
}
diff --git a/bin/varnishd/cache/cache_dir_dns.c b/bin/varnishd/cache/cache_dir_dns.c
index 56bce48..517caaa 100644
--- a/bin/varnishd/cache/cache_dir_dns.c
+++ b/bin/varnishd/cache/cache_dir_dns.c
@@ -403,8 +403,8 @@ vdi_dns_healthy(const struct director *dir, const struct sess *sp)
int i;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
- CAST_OBJ_NOTNULL(vs, sp->director->priv, VDI_DNS_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->req->director, DIRECTOR_MAGIC);
+ CAST_OBJ_NOTNULL(vs, sp->req->director->priv, VDI_DNS_MAGIC);
dir = vdi_dns_find_backend(sp, vs);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 36ff704..e1d3945 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -80,7 +80,7 @@ ved_include(struct sess *sp, const char *src, const char *host)
* XXX: or not (for session/backend coupling). Until then
* XXX: make sure we don't trip up the check in vcl_recv.
*/
- sp->director = NULL;
+ sp->req->director = NULL;
sp->step = STP_RECV;
http_ForceGet(sp->http);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 79d0665..9f1d822 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -390,7 +390,7 @@ FetchHdr(struct sess *sp, int need_host_hdr)
CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
htc = &wrk->busyobj->htc;
- AN(sp->director);
+ AN(sp->req->director);
AZ(sp->wrk->obj);
if (sp->wrk->objcore != NULL) { /* pass has no objcore */
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 627db48..dbcca41 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -302,7 +302,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC);
- AN(sp->director);
+ AN(sp->req->director);
AN(hash);
wrk = sp->wrk;
@@ -393,7 +393,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
if (oc == NULL /* We found no live object */
&& grace_oc != NULL /* There is a grace candidate */
&& (busy_oc != NULL /* Somebody else is already busy */
- || !VDI_Healthy(sp->director, sp))) {
+ || !VDI_Healthy(sp->req->director, sp))) {
/* Or it is impossible to fetch */
o = oc_getobj(sp->wrk, grace_oc);
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 44c8fc3..9710517 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -254,10 +254,10 @@ pan_sess(const struct sess *sp)
VSB_printf(pan_vsp, " handling = %s,\n", hand);
else
VSB_printf(pan_vsp, " handling = 0x%x,\n", sp->req->handling);
- if (sp->err_code)
+ if (sp->req->err_code)
VSB_printf(pan_vsp,
- " err_code = %d, err_reason = %s,\n", sp->err_code,
- sp->err_reason ? sp->err_reason : "(null)");
+ " err_code = %d, err_reason = %s,\n", sp->req->err_code,
+ sp->req->err_reason ? sp->req->err_reason : "(null)");
VSB_printf(pan_vsp, " restarts = %d, esi_level = %d\n",
sp->req->restarts, sp->req->esi_level);
@@ -271,8 +271,8 @@ pan_sess(const struct sess *sp)
if (sp->wrk != NULL)
pan_wrk(sp->wrk);
- if (VALID_OBJ(sp->vcl, VCL_CONF_MAGIC))
- pan_vcl(sp->vcl);
+ if (VALID_OBJ(sp->req->vcl, VCL_CONF_MAGIC))
+ pan_vcl(sp->req->vcl);
if (VALID_OBJ(sp->wrk->obj, OBJECT_MAGIC))
pan_object(sp->wrk->obj);
diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c
index cc98fba..8bf76f3 100644
--- a/bin/varnishd/cache/cache_pipe.c
+++ b/bin/varnishd/cache/cache_pipe.c
@@ -94,7 +94,7 @@ PipeSession(struct sess *sp)
return;
}
- sp->t_resp = VTIM_real();
+ sp->req->t_resp = VTIM_real();
memset(fds, 0, sizeof fds);
diff --git a/bin/varnishd/cache/cache_response.c b/bin/varnishd/cache/cache_response.c
index e5dbf86..fe5f29f 100644
--- a/bin/varnishd/cache/cache_response.c
+++ b/bin/varnishd/cache/cache_response.c
@@ -139,7 +139,7 @@ RES_BuildHttp(const struct sess *sp)
http_PrintfHeader(sp->wrk, sp->vsl_id, sp->wrk->resp,
"X-Varnish: %u", sp->req->xid);
http_PrintfHeader(sp->wrk, sp->vsl_id, sp->wrk->resp, "Age: %.0f",
- sp->wrk->obj->exp.age + sp->t_resp - sp->wrk->obj->exp.entered);
+ sp->wrk->obj->exp.age + sp->req->t_resp - sp->wrk->obj->exp.entered);
http_SetHeader(sp->wrk, sp->vsl_id, sp->wrk->resp, "Via: 1.1 varnish");
http_PrintfHeader(sp->wrk, sp->vsl_id, sp->wrk->resp, "Connection: %s",
sp->req->doclose ? "close" : "keep-alive");
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index 2878d9a..5c5e5e2 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -98,7 +98,7 @@ RFC2616_Ttl(const struct sess *sp)
if (http_GetHdr(hp, H_Date, &p))
h_date = VTIM_parse(p);
- switch (sp->err_code) {
+ switch (sp->req->err_code) {
default:
expp->ttl = -1.;
break;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index f1f502a..42ce7df 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -82,7 +82,7 @@ SES_Charge(struct sess *sp)
{
struct acct *a = &sp->wrk->acct_tmp;
- sp->req_bodybytes += a->bodybytes;
+ sp->req->req_bodybytes += a->bodybytes;
#define ACCT(foo) \
sp->wrk->stats.s_##foo += a->foo; \
@@ -170,7 +170,6 @@ ses_setup(struct sessmem *sm)
sp->t_open = NAN;
sp->t_idle = NAN;
sp->t_req = NAN;
- sp->t_resp = NAN;
WS_Init(sp->ws, "sess", sm->wsp, sm->workspace);
sp->http = sm->http[0];
@@ -274,12 +273,12 @@ SES_Schedule(struct sess *sp)
if (Pool_Schedule(pp->pool, sp)) {
VSC_C_main->client_drop_late++;
sp->t_idle = VTIM_real();
- if (sp->vcl != NULL) {
+ if (sp->req->vcl != NULL) {
/*
* A session parked on a busy object can come here
* after it wakes up. Loose the VCL reference.
*/
- VCL_Rel(&sp->vcl);
+ VCL_Rel(&sp->req->vcl);
}
SES_Delete(sp, "dropped", sp->t_idle);
return (1);
@@ -349,10 +348,11 @@ SES_Delete(struct sess *sp, const char *reason, double now)
assert(!isnan(sp->t_open));
assert(sp->fd < 0);
- if (sp->req != NULL)
+ if (sp->req != NULL) {
+ AZ(sp->req->vcl);
SES_ReleaseReq(sp);
+ }
- AZ(sp->vcl);
if (*sp->addr == '\0')
strcpy(sp->addr, "-");
if (*sp->port == '\0')
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 06d4bd7..4cf61c4 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -336,7 +336,7 @@ VCL_##func##_method(struct sess *sp) \
sp->req->handling = 0; \
sp->req->cur_method = VCL_MET_ ## upper; \
WSP(sp, SLT_VCL_call, "%s", #func); \
- (void)sp->vcl->func##_func(sp); \
+ (void)sp->req->vcl->func##_func(sp); \
WSP(sp, SLT_VCL_return, "%s", VCL_Return_Name(sp->req->handling)); \
sp->req->cur_method = 0; \
assert((1U << sp->req->handling) & bitmap); \
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 9ec88cc..e078f8f 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -60,8 +60,8 @@ VRT_error(struct sess *sp, unsigned code, const char *reason)
reason : "(null)");
if (code < 100 || code > 999)
code = 503;
- sp->err_code = (uint16_t)code;
- sp->err_reason = reason ? reason : http_StatusMessage(sp->err_code);
+ sp->req->err_code = (uint16_t)code;
+ sp->req->err_reason = reason ? reason : http_StatusMessage(sp->req->err_code);
}
/*--------------------------------------------------------------------*/
@@ -75,7 +75,7 @@ VRT_count(const struct sess *sp, unsigned u)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
if (cache_param->vcl_trace)
WSP(sp, SLT_VCL_trace, "%u %u.%u", u,
- sp->vcl->ref[u].line, sp->vcl->ref[u].pos);
+ sp->req->vcl->ref[u].line, sp->req->vcl->ref[u].pos);
}
/*--------------------------------------------------------------------*/
@@ -351,7 +351,7 @@ VRT_backend_string(const struct sess *sp, const struct director *d)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
if (d == NULL)
- d = sp->director;
+ d = sp->req->director;
if (d == NULL)
return (NULL);
return (d->vcl_name);
@@ -372,7 +372,7 @@ VRT_Rollback(struct sess *sp)
{
HTTP_Copy(sp->http, sp->http0);
- WS_Reset(sp->ws, sp->ws_req);
+ WS_Reset(sp->ws, sp->req->ws_req);
}
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 8c95d5b..aef935b 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -307,14 +307,14 @@ void
VRT_l_req_backend(struct sess *sp, struct director *be)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- sp->director = be;
+ sp->req->director = be;
}
struct director * __match_proto__()
VRT_r_req_backend(struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- return (sp->director);
+ return (sp->req->director);
}
/*--------------------------------------------------------------------*/
@@ -548,7 +548,7 @@ unsigned
VRT_r_req_backend_healthy(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
- return (VDI_Healthy(sp->director, sp));
+ CHECK_OBJ_NOTNULL(sp->req->director, DIRECTOR_MAGIC);
+ return (VDI_Healthy(sp->req->director, sp));
}
diff --git a/bin/varnishd/cache/cache_wrw.c b/bin/varnishd/cache/cache_wrw.c
index 96fa3e5..c344f9c 100644
--- a/bin/varnishd/cache/cache_wrw.c
+++ b/bin/varnishd/cache/cache_wrw.c
@@ -159,7 +159,7 @@ WRW_Flush(struct worker *wrk)
* counter to prevent slowlaris attacks
*/
- if (VTIM_real() - wrk->sp->t_resp >
+ if (VTIM_real() - wrk->sp->req->t_resp >
cache_param->send_timeout) {
WSL(wrk, SLT_Debug, *wrw->wfd,
"Hit total send timeout, "
diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c
index 44e9721..b0f461a 100644
--- a/bin/varnishd/waiter/cache_waiter.c
+++ b/bin/varnishd/waiter/cache_waiter.c
@@ -69,7 +69,6 @@ WAIT_Enter(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
AZ(sp->req);
- AZ(sp->vcl);
assert(sp->fd >= 0);
sp->wrk = NULL;
More information about the varnish-commit
mailing list