[master] f278f8b Warn on duplicate Begin log records

Martin Blix Grydeland martin at varnish-software.com
Thu Feb 27 15:21:08 CET 2014


commit f278f8b2ac33b51d8a35b5ad26f58dd5bbfd7d5a
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Feb 27 12:35:50 2014 +0100

    Warn on duplicate Begin log records

diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c
index 3acdbd2..8a7f6e6 100644
--- a/lib/libvarnishapi/vsl_dispatch.c
+++ b/lib/libvarnishapi/vsl_dispatch.c
@@ -855,8 +855,12 @@ vtx_scan(struct VSLQ *vslq, struct vtx *vtx)
 
 		switch (tag) {
 		case SLT_Begin:
-			(void)vtx_scan_begin(vslq, vtx, ptr);
-			vtx->flags |= VTX_F_BEGIN;
+			if (vtx->flags & VTX_F_BEGIN)
+				(void)vtx_diag_tag(vtx, ptr, "duplicate begin");
+			else {
+				(void)vtx_scan_begin(vslq, vtx, ptr);
+				vtx->flags |= VTX_F_BEGIN;
+			}
 			break;
 
 		case SLT_Link:
@@ -864,15 +868,15 @@ vtx_scan(struct VSLQ *vslq, struct vtx *vtx)
 			break;
 
 		case SLT_End:
+			AZ(vtx->flags & VTX_F_END);
 			vtx->flags |= VTX_F_END;
+			vtx_mark_complete(vslq, vtx);
 			break;
+
 		default:
 			break;
 		}
 	}
-
-	if (vtx->flags & VTX_F_END && !(vtx->flags & VTX_F_COMPLETE))
-		vtx_mark_complete(vslq, vtx);
 }
 
 /* Force a vtx into complete status by synthing the necessary outstanding



More information about the varnish-commit mailing list