[master] 7ce5f508f http2_send: Collect the timeout error

Simon Stridsberg simon.stridsberg at varnish-software.com
Mon Mar 18 18:32:06 UTC 2024


commit 7ce5f508f55706709c7e42531d001d6e554c5f42
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Nov 16 13:23:18 2023 +0100

    http2_send: Collect the timeout error

diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index ac07d542c..ac634e9ec 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -48,6 +48,7 @@ h2_cond_wait(pthread_cond_t *cond, struct h2_sess *h2, struct h2_req *r2)
 {
 	vtim_dur tmo = 0.;
 	vtim_real now;
+	h2_error h2e;
 	int r;
 
 	AN(cond);
@@ -72,18 +73,16 @@ h2_cond_wait(pthread_cond_t *cond, struct h2_sess *h2, struct h2_req *r2)
 	 * that the stream reached the idle_send_timeout via the lock and
 	 * force it to log it.
 	 */
-	if (h2_stream_tmo(h2, r2, now))
-		r = ETIMEDOUT;
-	else if (r == ETIMEDOUT)
-		AN(h2_stream_tmo(h2, r2, NAN));
-
-	if (r == ETIMEDOUT) {
-		if (r2->error == NULL)
-			r2->error = H2SE_CANCEL;
-		return (-1);
+	h2e = h2_stream_tmo(h2, r2, now);
+	if (h2e == NULL && r == ETIMEDOUT) {
+		h2e = h2_stream_tmo(h2, r2, NAN);
+		AN(h2e);
 	}
 
-	return (0);
+	if (r2->error == NULL)
+		r2->error = h2e;
+
+	return (h2e != NULL ? -1 : 0);
 }
 
 static void


More information about the varnish-commit mailing list