[6.0] f3f15136d Add an assert that VRT_delete_backend is only called once

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

commit f3f15136d56b11a9e72a1c9500e29b3e62dd8c17
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Dec 4 13:10:07 2019 +0100

    Add an assert that VRT_delete_backend is only called once
    VRT_delete_backend() sets be->cooled to non-zero as the only place where
    that is done. Assert that it is zero on entry as a check that
    VRT_delete_backend isn't called multiple times.

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index ba0e649ed..70efe08af 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -566,6 +566,7 @@ VRT_delete_backend(VRT_CTX, struct director **dp)
 	be->director->health_changed = VTIM_real();
+	AZ(be->cooled);
 	be->cooled = VTIM_real() + 60.;
 	VTAILQ_REMOVE(&backends, be, list);
 	VTAILQ_INSERT_TAIL(&cool_backends, be, list);

More information about the varnish-commit mailing list