From 41cf3037ea44a8e3865f9e56343f49f1957cfd79 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 24 Nov 2008 12:27:25 +0000 Subject: [PATCH] Count ESI processed objects in acct.bodybytes git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3423 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vrt_esi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_vrt_esi.c b/varnish-cache/bin/varnishd/cache_vrt_esi.c index eaa8d5b7..b213bff6 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_esi.c +++ b/varnish-cache/bin/varnishd/cache_vrt_esi.c @@ -800,12 +800,14 @@ ESI_Deliver(struct sess *sp) struct object *obj; VTAILQ_FOREACH(eb, &sp->obj->esibits, list) { + assert(sp->wrk->wfd = &sp->fd); if (Tlen(eb->verbatim)) { if (sp->http->protover >= 1.1) - WRK_Write(sp->wrk, eb->chunk_length, -1); - WRK_Write(sp->wrk, eb->verbatim.b, Tlen(eb->verbatim)); + (void)WRK_Write(sp->wrk, eb->chunk_length, -1); + sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, + eb->verbatim.b, Tlen(eb->verbatim)); if (sp->http->protover >= 1.1) - WRK_Write(sp->wrk, "\r\n", -1); + (void)WRK_Write(sp->wrk, "\r\n", -1); } if (eb->include.b == NULL || sp->esis >= params->max_esi_includes) @@ -814,9 +816,10 @@ ESI_Deliver(struct sess *sp) /* * We flush here, because the next transaction is * quite likely to take some time, so we should get - * as many bits to the client as we can already + * as many bits to the client as we can already. */ - WRK_Flush(sp->wrk); + if (WRK_Flush(sp->wrk)) + break; sp->esis++; obj = sp->obj; @@ -852,8 +855,9 @@ ESI_Deliver(struct sess *sp) sp->obj = obj; } + assert(sp->wrk->wfd = &sp->fd); if (sp->esis == 0 && sp->http->protover >= 1.1) - WRK_Write(sp->wrk, "0\r\n\r\n", -1); + (void)WRK_Write(sp->wrk, "0\r\n\r\n", -1); } /*--------------------------------------------------------------------*/ -- 2.39.5