[experimental-ims] 223ff71 Do the zero check last, so a varnishd restart has a chance to recover it.

Geoff Simmons geoff at varnish-cache.org
Mon Jan 9 21:52:00 CET 2012


commit 223ff71a0ce19a7d33d3e06f800fa6e7b8a713e4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Sep 20 15:25:44 2011 +0000

    Do the zero check last, so a varnishd restart has a chance to recover it.

diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 1bc46dd..58a454d 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -173,13 +173,6 @@ vsl_nextlog(struct vsl *vsl, uint32_t **pp)
 	for (w = 0; w < TIMEOUT_USEC;) {
 		t = *vsl->log_ptr;
 
-		if (t == 0) {
-			/* Zero-initialized VSL */
-			w += SLEEP_USEC;
-			assert(usleep(SLEEP_USEC) == 0 || errno == EINTR);
-			VRMB();
-			continue;
-		}
 		if (t == VSL_WRAPMARKER) {
 			/* Wrap around not possible at front */
 			assert(vsl->log_ptr != vsl->log_start + 1);
@@ -202,6 +195,13 @@ vsl_nextlog(struct vsl *vsl, uint32_t **pp)
 			VRMB();
 			continue;
 		}
+		if (t == 0) {
+			/* Zero-initialized VSL */
+			w += SLEEP_USEC;
+			assert(usleep(SLEEP_USEC) == 0 || errno == EINTR);
+			VRMB();
+			continue;
+		}
 		if (vsl->log_ptr == vsl->log_start + 1)
 			vsl->last_seq = vsl->log_start[0];
 



More information about the varnish-commit mailing list