Commit 3abbb127 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move another 56 bytes from sess to req

parent 097e646a
......@@ -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 ------------------------------------------------*/
......
......@@ -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);
}
......
This diff is collapsed.
......@@ -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));
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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");
......
......@@ -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;
......
......@@ -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')
......
......@@ -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); \
......
......@@ -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);
}
/*--------------------------------------------------------------------*/
......
......@@ -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));
}
......@@ -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, "
......
......@@ -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;
......
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