[6.0] e7a491a71 Don't bother with the return value from H2_Send(), we rely on h2_errcheck() calls anyway.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:52:54 UTC 2018


commit e7a491a711ef51eed38fc3581735308ab77d7849
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed May 2 22:17:58 2018 +0000

    Don't bother with the return value from H2_Send(), we
    rely on h2_errcheck() calls anyway.

diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index cfe8598fd..a1d6f849b 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -220,7 +220,7 @@ h2_error H2_Send_Frame(struct worker *, const struct h2_sess *,
     h2_frame type, uint8_t flags, uint32_t len, uint32_t stream,
     const void *);
 
-h2_error H2_Send(struct worker *, struct h2_req *,
+void H2_Send(struct worker *, struct h2_req *,
     h2_frame type, uint8_t flags, uint32_t len, const void *);
 
 /* cache_http2_proto.c */
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index a0ff969e6..2b7f695fa 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -91,8 +91,8 @@ h2_bytes(struct req *req, enum vdp_action act, void **priv,
 	    H2_F_DATA,
 	    act == VDP_FINI ? H2FF_DATA_END_STREAM : H2FF_NONE,
 	    len, ptr);
-	req->acct.resp_bodybytes += len;
 	H2_Send_Rel(r2->h2sess, r2);
+	req->acct.resp_bodybytes += len;
 	return (0);
 }
 
@@ -260,8 +260,8 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
 	H2_Send(req->wrk, r2, H2_F_HEADERS,
 	    (sendbody ? 0 : H2FF_HEADERS_END_STREAM) | H2FF_HEADERS_END_HEADERS,
 	    sz, req->ws->f);
-	req->acct.resp_hdrbytes += sz;
 	H2_Send_Rel(r2->h2sess, r2);
+	req->acct.resp_hdrbytes += sz;
 
 	WS_Release(req->ws, 0);
 
diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index 839193fd0..cfbb51be7 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -245,7 +245,7 @@ h2_do_window(struct worker *wrk, struct h2_req *r2,
  * XXX: priority
  */
 
-h2_error
+void
 H2_Send(struct worker *wrk, struct h2_req *r2,
     h2_frame ftyp, uint8_t flags, uint32_t len, const void *ptr)
 {
@@ -263,9 +263,8 @@ H2_Send(struct worker *wrk, struct h2_req *r2,
 
 	assert(VTAILQ_FIRST(&h2->txqueue) == r2);
 
-	retval = h2_errcheck(r2, h2);
-	if (retval)
-		return (retval);
+	if (h2_errcheck(r2, h2))
+		return;
 
 	AN(ftyp);
 	AZ(flags & ~(ftyp->flags));
@@ -281,15 +280,14 @@ H2_Send(struct worker *wrk, struct h2_req *r2,
 	if (ftyp->respect_window) {
 		tf = h2_do_window(wrk, r2, h2,
 				  (len > mfs) ? mfs : len);
-		retval = h2_errcheck(r2, h2);
-		if (retval)
-			return (retval);
+		if (h2_errcheck(r2, h2))
+			return;
 		assert(VTAILQ_FIRST(&h2->txqueue) == r2);
 	} else
 		tf = mfs;
 
 	if (len <= tf) {
-		retval = H2_Send_Frame(wrk, h2,
+		(void)H2_Send_Frame(wrk, h2,
 		    ftyp, flags, len, r2->stream, ptr);
 	} else {
 		AN(ptr);
@@ -303,9 +301,8 @@ H2_Send(struct worker *wrk, struct h2_req *r2,
 			if (ftyp->respect_window && p != ptr) {
 				tf = h2_do_window(wrk, r2, h2,
 						  (len > mfs) ? mfs : len);
-				retval = h2_errcheck(r2, h2);
-				if (retval)
-					return (retval);
+				if (h2_errcheck(r2, h2))
+					return;
 				assert(VTAILQ_FIRST(&h2->txqueue) == r2);
 			}
 			if (tf < len) {
@@ -324,5 +321,4 @@ H2_Send(struct worker *wrk, struct h2_req *r2,
 			ftyp = ftyp->continuation;
 		} while (len > 0 && retval == 0);
 	}
-	return (retval);
 }


More information about the varnish-commit mailing list