[6.0] 85204bcb5 vbe: Generic sanity check of non-recyclable connections

Reza Naghibi reza at naghibi.com
Tue Apr 20 18:35:05 UTC 2021


commit 85204bcb5bc8c42d304325884c45539851a788cc
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 70efe08af..b5217bd4f 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -215,9 +215,15 @@ vbe_dir_finish(const struct director *d, struct worker *wrk,
 	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", *PFD_Fd(pfd),
 		    bp->director->display_name);


More information about the varnish-commit mailing list