Mailing List Archive

r1038 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2006-09-16 23:20:37 +0200 (Sat, 16 Sep 2006)
New Revision: 1038

Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_pass.c
trunk/varnish-cache/bin/varnishd/cache_response.c
trunk/varnish-cache/bin/varnishd/cache_session.c
Log:
Account directly into the session.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-09-16 21:14:29 UTC (rev 1037)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-09-16 21:20:37 UTC (rev 1038)
@@ -112,7 +112,6 @@
unsigned niov;
size_t liov;

- struct acct acct;
struct VCL_conf *vcl;
};


Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-09-16 21:14:29 UTC (rev 1037)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-09-16 21:20:37 UTC (rev 1038)
@@ -284,7 +284,7 @@
AZ(sp->vbc);
HSH_Ref(sp->obj); /* get another, STP_DELIVER will deref */
HSH_Unbusy(sp->obj);
- sp->wrk->acct.fetch++;
+ sp->acct.fetch++;
sp->step = STP_DELIVER;
return (0);
}
@@ -304,7 +304,7 @@
assert(sp->xid == 0);
VCA_Prep(sp);
sp->wrk->idle = sp->t_open.tv_sec;
- sp->wrk->acct.sess++;
+ sp->acct.sess++;
SES_RefSrcAddr(sp);
do
i = http_RecvSome(sp->fd, sp->http);
@@ -583,7 +583,7 @@
cnt_passbody(struct sess *sp)
{

- sp->wrk->acct.pass++;
+ sp->acct.pass++;
AN(sp->vbc);
PassBody(sp);
AZ(sp->vbc);
@@ -610,7 +610,7 @@
cnt_pipe(struct sess *sp)
{

- sp->wrk->acct.pipe++;
+ sp->acct.pipe++;
PipeSession(sp);
sp->step = STP_DONE;
return (0);
@@ -662,7 +662,7 @@
AZ(sp->obj);
AZ(sp->vbc);

- sp->wrk->acct.req++;
+ sp->acct.req++;
done = http_DissectRequest(sp->http, sp->fd);
if (done != 0) {
RES_Error(sp, done, NULL);

Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-09-16 21:14:29 UTC (rev 1037)
+++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-09-16 21:20:37 UTC (rev 1038)
@@ -49,7 +49,7 @@
vca_close_session(sp, "backend closed");
return (1);
}
- sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, buf, i);
+ sp->acct.bodybytes += WRK_Write(sp->wrk, buf, i);
if (WRK_Flush(sp->wrk))
vca_close_session(sp, "remote closed");
cl -= i;
@@ -104,7 +104,7 @@

/* we just received the final zero-length chunk */
if (u == 0) {
- sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, q - p);
+ sp->acct.bodybytes += WRK_Write(sp->wrk, p, q - p);
break;
}

@@ -118,7 +118,7 @@
j = u;
if (bp - p < j)
j = bp - p;
- sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, j);
+ sp->acct.bodybytes += WRK_Write(sp->wrk, p, j);
WRK_Flush(sp->wrk);
p += j;
assert(u >= j);
@@ -164,7 +164,7 @@
if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked"))
http_PrintfHeader(sp->fd, sp->http, "Transfer-Encoding: chunked");
WRK_Reset(sp->wrk, &sp->fd);
- sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
+ sp->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);

if (http_GetHdr(vc->http, H_Content_Length, &b))
cls = pass_straight(sp, vc->fd, vc->http, b);

Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-09-16 21:14:29 UTC (rev 1037)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-09-16 21:20:37 UTC (rev 1038)
@@ -127,7 +127,7 @@
"</HTML>\r\n");
vsb_finish(sb);
WRK_Reset(sp->wrk, &sp->fd);
- sp->wrk->acct.hdrbytes += WRK_Write(sp->wrk, vsb_data(sb), vsb_len(sb));
+ sp->acct.hdrbytes += WRK_Write(sp->wrk, vsb_data(sb), vsb_len(sb));
WRK_Flush(sp->wrk);
VSL(SLT_TxStatus, sp->id, "%d", code);
VSL(SLT_TxProtocol, sp->id, "HTTP/1.1");
@@ -158,7 +158,7 @@
if (sp->doclose != NULL)
http_SetHeader(sp->fd, sp->http, "Connection: close");
WRK_Reset(sp->wrk, &sp->fd);
- sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
+ sp->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
if (WRK_Flush(sp->wrk))
vca_close_session(sp, "remote closed");
}
@@ -216,7 +216,7 @@
if (sp->doclose != NULL)
http_SetHeader(sp->fd, sp->http, "Connection: close");
WRK_Reset(sp->wrk, &sp->fd);
- sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
+ sp->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);

if (sp->wantbody) {
@@ -225,7 +225,7 @@
CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
AN(st->stevedore);
u += st->len;
- sp->wrk->acct.bodybytes += st->len;
+ sp->acct.bodybytes += st->len;
#ifdef HAVE_SENDFILE
/*
* XXX: the overhead of setting up senddile is not

Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-09-16 21:14:29 UTC (rev 1037)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-09-16 21:20:37 UTC (rev 1038)
@@ -198,11 +198,9 @@
void
SES_Charge(struct sess *sp)
{
- struct acct *a = &sp->wrk->acct;
+ struct acct *a = &sp->acct;
struct acct *b;

- ses_sum_acct(&sp->acct, a);
-
if (sp->srcaddr != NULL) {
CHECK_OBJ(sp->srcaddr, SRCADDR_MAGIC);
LOCK(&sp->srcaddr->sah->mtx);