[master] 8cecc14 Simplify

Poul-Henning Kamp phk at FreeBSD.org
Fri Mar 10 07:47:05 CET 2017


commit 8cecc142221aa7e65521761d64c8254c5b448694
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Mar 10 06:45:50 2017 +0000

    Simplify

diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index d6971d9..ff49237 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -144,6 +144,8 @@ struct h2_sess {
 	uint32_t			highest_stream;
 	int				bogosity;
 
+	struct h2_req			*req0;
+
 	struct h2_req_s			streams;
 
 	struct req			*srq;
@@ -166,7 +168,6 @@ struct h2_sess {
 
 	VTAILQ_HEAD(,h2_req)		txqueue;
 
-	struct h2_req			req0[1];
 	h2_error			error;
 };
 
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 0b063b7..46dbd6c 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -109,8 +109,6 @@ h2_new_sess(const struct worker *wrk, struct sess *sp, struct req *srq)
 
 		SES_Reserve_xport_priv(sp, &up);
 		*up = (uintptr_t)h2;
-		INIT_OBJ(h2->req0, H2_REQ_MAGIC);
-		h2->req0->h2sess = h2;
 	}
 	AN(up);
 	CAST_OBJ_NOTNULL(h2, (void*)(*up), H2_SESS_MAGIC);
@@ -215,7 +213,7 @@ h2_b64url_settings(struct h2_sess *h2, struct req *req)
 /**********************************************************************/
 
 static int
-h2_new_pu_session(struct worker *wrk, const struct h2_sess *h2)
+h2_pu_session(struct worker *wrk, const struct h2_sess *h2)
 {
 	enum htc_status_e hs;
 
@@ -240,7 +238,7 @@ h2_new_pu_session(struct worker *wrk, const struct h2_sess *h2)
 /**********************************************************************/
 
 static int
-h2_new_ou_session(const struct worker *wrk, struct h2_sess *h2,
+h2_ou_session(const struct worker *wrk, struct h2_sess *h2,
     struct req *req)
 {
 	ssize_t sz;
@@ -333,12 +331,10 @@ h2_new_session(struct worker *wrk, void *arg)
 
 	h2 = h2_new_sess(wrk, sp, req->err_code == H2_PU_MARKER ? req : NULL);
 	wsp = WS_Snapshot(h2->ws);
-	(void)h2_new_req(wrk, h2, 0, NULL);
+	h2->req0 = h2_new_req(wrk, h2, 0, NULL);
 
-	if (req->err_code == H2_PU_MARKER && !h2_new_pu_session(wrk, h2))
-		return;
-
-	if (req->err_code == H2_OU_MARKER && !h2_new_ou_session(wrk, h2, req)) {
+	if ((req->err_code == H2_PU_MARKER && !h2_pu_session(wrk, h2)) ||
+	    (req->err_code == H2_OU_MARKER && !h2_ou_session(wrk, h2, req))) {
 		CNT_AcctLogCharge(wrk->stats, req);
 		VCL_Rel(&req->vcl);
 		Req_Release(req);



More information about the varnish-commit mailing list