r4779 - in trunk/varnish-cache: bin/varnishd lib/libvcl

phk at varnish-cache.org phk at varnish-cache.org
Thu May 6 13:02:23 CEST 2010


Author: phk
Date: 2010-05-06 13:02:23 +0200 (Thu, 06 May 2010)
New Revision: 4779

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
   trunk/varnish-cache/lib/libvcl/vcc_backend.c
Log:
Make varnishd -L mode work with or without -b arguments



Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2010-05-06 10:06:06 UTC (rev 4778)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2010-05-06 11:02:23 UTC (rev 4779)
@@ -335,7 +335,16 @@
 
 	/* XXX: annotate vcl with -b/-f arg so people know where it came from */
 	(void)f_arg;
-	if (b_arg != NULL) {
+
+	if (L_arg && b_arg == NULL) {
+		bprintf(buf, 
+		    "backend default {\n"
+		    "    .host = \"127.0.0.1\";\n"
+		    "    .port = %s;\n"
+		    "}\n", "Learn(0)");
+		vcl = strdup(buf);
+		AN(vcl);
+	} else if (b_arg != NULL) {
 		AZ(vcl);
 		/*
 		 * XXX: should do a "HEAD /" on the -b argument to see that

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2010-05-06 10:06:06 UTC (rev 4778)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2010-05-06 11:02:23 UTC (rev 4779)
@@ -675,7 +675,7 @@
 		exit(1);
 	}
 
-	if (b_arg != NULL || f_arg != NULL)
+	if (b_arg != NULL || f_arg != NULL || L_arg > 0)
 		if (mgt_vcc_default(b_arg, f_arg, vcl, C_flag))
 			exit (2);
 

Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c	2010-05-06 10:06:06 UTC (rev 4778)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c	2010-05-06 11:02:23 UTC (rev 4779)
@@ -551,7 +551,6 @@
 
 	/* Check that the portname makes sense */
 	if (Learn_mode && t_port != NULL && t_port->tok == CNUM) {
-		assert(tL_port);
 		bprintf(tmpbuf, "%u", Learn_mode + 10 + tL_port);
 		Emit_Sockaddr(tl, t_host, tmpbuf);
 	} else if (t_port != NULL) {




More information about the varnish-commit mailing list