[master] 2e125484e Give VRB_Iterate() explicit wrk+vsl_log arguments, since it is called from both client and backend side.

Poul-Henning Kamp phk at FreeBSD.org
Thu Oct 31 13:24:06 UTC 2019


commit 2e125484ef5285628794dc19ac9093d3520ce333
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 31 13:17:20 2019 +0000

    Give VRB_Iterate() explicit wrk+vsl_log arguments, since it is called
    from both client and backend side.

diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index 13c4ed07f..ddb2fdc6e 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -179,7 +179,8 @@ vrb_pull(struct req *req, ssize_t maxsize, objiterate_f *func, void *priv)
  */
 
 ssize_t
-VRB_Iterate(struct req *req, objiterate_f *func, void *priv)
+VRB_Iterate(struct worker *wrk, struct vsl_log *vsl,
+    struct req *req, objiterate_f *func, void *priv)
 {
 	int i;
 
@@ -189,7 +190,7 @@ VRB_Iterate(struct req *req, objiterate_f *func, void *priv)
 	switch (req->req_body_status) {
 	case REQ_BODY_CACHED:
 		AN(req->body_oc);
-		if (ObjIterate(req->wrk, req->body_oc, priv, func, 0))
+		if (ObjIterate(wrk, req->body_oc, priv, func, 0))
 			return (-1);
 		return (0);
 	case REQ_BODY_NONE:
@@ -198,11 +199,11 @@ VRB_Iterate(struct req *req, objiterate_f *func, void *priv)
 	case REQ_BODY_WITHOUT_LEN:
 		break;
 	case REQ_BODY_TAKEN:
-		VSLb(req->vsl, SLT_VCL_Error,
+		VSLb(vsl, SLT_VCL_Error,
 		    "Uncached req.body can only be consumed once.");
 		return (-1);
 	case REQ_BODY_FAIL:
-		VSLb(req->vsl, SLT_FetchError,
+		VSLb(vsl, SLT_FetchError,
 		    "Had failed reading req.body before.");
 		return (-1);
 	default:
@@ -217,7 +218,7 @@ VRB_Iterate(struct req *req, objiterate_f *func, void *priv)
 		i = -1;
 	Lck_Unlock(&req->sp->mtx);
 	if (i) {
-		VSLb(req->vsl, SLT_VCL_Error,
+		VSLb(vsl, SLT_VCL_Error,
 		    "Multiple attempts to access non-cached req.body");
 		return (i);
 	}
@@ -253,7 +254,7 @@ VRB_Ignore(struct req *req)
 		return (0);
 	if (req->req_body_status == REQ_BODY_WITH_LEN ||
 	    req->req_body_status == REQ_BODY_WITHOUT_LEN)
-		(void)VRB_Iterate(req, httpq_req_body_discard, NULL);
+		(void)VRB_Iterate(req->wrk, req->vsl, req, httpq_req_body_discard, NULL);
 	return (0);
 }
 
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index 6a1ace8aa..f242b229c 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -355,7 +355,8 @@ void Req_AcctLogCharge(struct VSC_main_wrk *, struct req *);
 /* cache_req_body.c */
 int VRB_Ignore(struct req *);
 ssize_t VRB_Cache(struct req *, ssize_t maxsize);
-ssize_t VRB_Iterate(struct req *, objiterate_f *func, void *priv);
+ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
+    objiterate_f *func, void *priv);
 void VRB_Free(struct req *);
 
 /* cache_req_fsm.c [CNT] */
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index dc1515ef1..12d5e7c2b 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -108,7 +108,7 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr_hdrbytes,
 	    (bo->req->req_body_status == REQ_BODY_CACHED || !onlycached)) {
 		if (do_chunked)
 			V1L_Chunked(wrk);
-		i = VRB_Iterate(bo->req, vbf_iter_req_body, bo);
+		i = VRB_Iterate(wrk, bo->vsl, bo->req, vbf_iter_req_body, bo);
 
 		if (bo->req->req_body_status == REQ_BODY_FAIL) {
 			/*


More information about the varnish-commit mailing list