[master] 6233b0884 More work on refactoring req-cleanup
Poul-Henning Kamp
phk at FreeBSD.org
Tue Jan 22 08:24:07 UTC 2019
commit 6233b08842d8ea48e78b9fc5381a26a2c753862e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Jan 22 08:23:02 2019 +0000
More work on refactoring req-cleanup
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index 0cd80c20a..630e47f07 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -43,8 +43,8 @@
#include "vtim.h"
-void
-Req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req)
+static void
+req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req)
{
struct acct_req *a;
@@ -167,8 +167,7 @@ Req_Release(struct req *req)
#include "tbl/acct_fields_req.h"
AZ(req->vcl);
- if (req->vsl->wid)
- VSL_End(req->vsl);
+ AZ(req->vsl->wid);
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
pp = sp->pool;
@@ -222,10 +221,9 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
VCL_Recache(wrk, &req->vcl);
/* Charge and log byte counters */
- if (req->vsl->wid) {
- Req_AcctLogCharge(wrk->stats, req);
+ req_AcctLogCharge(wrk->stats, req);
+ if (req->vsl->wid)
VSL_End(req->vsl);
- }
req->req_bodybytes = 0;
if (!isnan(req->t_prev) && req->t_prev > 0. && req->t_prev > sp->t_idle)
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index d85892de3..38ca918a7 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -313,7 +313,6 @@ void Req_Release(struct req *);
void Req_Rollback(struct req *req);
void Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req);
void Req_Fail(struct req *req, enum sess_close reason);
-void Req_AcctLogCharge(struct VSC_main_wrk *, struct req *);
/* cache_req_body.c */
int VRB_Ignore(struct req *);
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 05c1c4f06..14b36d4d2 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -337,7 +337,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
if (hs < HTC_S_EMPTY) {
req->acct.req_hdrbytes +=
req->htc->rxbuf_e - req->htc->rxbuf_b;
- Req_AcctLogCharge(wrk->stats, req);
+ Req_Cleanup(sp, wrk, req);
Req_Release(req);
switch (hs) {
case HTC_S_CLOSE:
@@ -358,6 +358,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
}
if (hs == HTC_S_IDLE) {
wrk->stats->sess_herd++;
+ Req_Cleanup(sp, wrk, req);
Req_Release(req);
SES_Wait(sp, &HTTP1_transport);
return;
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 115ec6b8d..eee053931 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -240,7 +240,7 @@ h2_ou_rel(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
AZ(req->vcl);
- Req_AcctLogCharge(wrk->stats, req);
+ Req_Cleanup(req->sp, wrk, req);
Req_Release(req);
return (0);
}
More information about the varnish-commit
mailing list