[master] 897695814 vbe: Generic sanity check of non-recyclable connections

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Mar 25 10:23:06 UTC 2021


commit 897695814fa026dc263ed293caa822262c73a83a
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Mar 24 17:39:47 2021 +0100

    vbe: Generic sanity check of non-recyclable connections
    
    The reason we expect here can be summarized as: this was a pipe
    transaction or an error occurred. This could be much simpler if
    we replaced enum sess_close with a struct stream_close instead.
    
    Refs dc5bddbd301529b101598b644544b99ccabca12c

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 3e55cb2ec..d16ecbbd6 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -231,9 +231,15 @@ vbe_dir_finish(VRT_CTX, VCL_BACKEND d)
 	CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC);
 	pfd = bo->htc->priv;
 	bo->htc->priv = NULL;
-	if (PFD_State(pfd) != PFD_STATE_USED)
-		assert(bo->htc->doclose == SC_TX_PIPE ||
-		    bo->htc->doclose == SC_RX_TIMEOUT);
+	if (PFD_State(pfd) != PFD_STATE_USED) {
+		AN(bo->htc->doclose);
+		if (bo->htc->doclose != SC_TX_PIPE) {
+#define SESS_CLOSE(U, l, err, desc)				\
+			if (bo->htc->doclose == SC_ ## U)	\
+				AN(err);
+#include "tbl/sess_close.h"
+		}
+	}
 	if (bo->htc->doclose != SC_NULL || bp->proxy_header != 0) {
 		VSLb(bo->vsl, SLT_BackendClose, "%d %s close", *PFD_Fd(pfd),
 		    VRT_BACKEND_string(bp->director));


More information about the varnish-commit mailing list