[master] 5e251ab Fix Ctrl-C handling in VUT_main

Martin Blix Grydeland martin at varnish-cache.org
Thu Oct 3 14:00:41 CEST 2013


commit 5e251abf50e2c02b84231e81a94b1c8cf6faecd5
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Oct 2 22:47:04 2013 +0200

    Fix Ctrl-C handling in VUT_main
    
    Left over code in VUT_main was preventing Ctrl-C handling when looping
    trying to reconnect. Remove offending code.

diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c
index 8c2f90c..0d331b8 100644
--- a/lib/libvarnishtools/vut.c
+++ b/lib/libvarnishtools/vut.c
@@ -259,6 +259,8 @@ VUT_Main(VSLQ_dispatch_f *func, void *priv)
 	struct VSL_cursor *c;
 	int i;
 
+	AN(VUT.vslq);
+
 	if (func == NULL) {
 		if (VUT.w_arg)
 			func = VSL_WriteTransactions;
@@ -281,6 +283,7 @@ VUT_Main(VSLQ_dispatch_f *func, void *priv)
 		}
 
 		if (VUT.vslq == NULL) {
+			/* Reconnect VSM */
 			AZ(VUT.r_arg);
 			AN(VUT.vsm);
 			VTIM_sleep(0.1);
@@ -291,6 +294,7 @@ VUT_Main(VSLQ_dispatch_f *func, void *priv)
 			c = VSL_CursorVSM(VUT.vsl, VUT.vsm, 1);
 			if (c == NULL) {
 				VSL_ResetError(VUT.vsl);
+				VSM_Close(VUT.vsm);
 				continue;
 			}
 			VUT.vslq = VSLQ_New(VUT.vsl, &c, VUT.g_arg, VUT.q_arg);
@@ -328,25 +332,6 @@ VUT_Main(VSLQ_dispatch_f *func, void *priv)
 			/* Overrun */
 			VUT_Error(0, "Log overrun");
 		}
-
-		/* Reconnect VSM */
-		while (VUT.vslq == NULL) {
-			AZ(VUT.r_arg);
-			AN(VUT.vsm);
-			VTIM_sleep(0.1);
-			if (VSM_Open(VUT.vsm)) {
-				VSM_ResetError(VUT.vsm);
-				continue;
-			}
-			c = VSL_CursorVSM(VUT.vsl, VUT.vsm, 1);
-			if (c == NULL) {
-				VSL_ResetError(VUT.vsl);
-				continue;
-			}
-			VUT.vslq = VSLQ_New(VUT.vsl, &c, VUT.g_arg, VUT.q_arg);
-			AN(VUT.vslq);
-			AZ(c);
-		}
 	}
 
 	if (VUT.vslq != NULL)



More information about the varnish-commit mailing list