r4954 - in trunk/varnish-cache: bin/varnishd bin/varnishstat bin/varnishtest include lib/libvarnish lib/libvarnishapi lib/libvcl

phk at varnish-cache.org phk at varnish-cache.org
Mon Jun 14 10:40:05 CEST 2010


Author: phk
Date: 2010-06-14 10:40:04 +0200 (Mon, 14 Jun 2010)
New Revision: 4954

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
   trunk/varnish-cache/bin/varnishstat/varnishstat.c
   trunk/varnish-cache/bin/varnishtest/vtc.c
   trunk/varnish-cache/bin/varnishtest/vtc.h
   trunk/varnish-cache/bin/varnishtest/vtc_client.c
   trunk/varnish-cache/bin/varnishtest/vtc_http.c
   trunk/varnish-cache/bin/varnishtest/vtc_server.c
   trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
   trunk/varnish-cache/include/libvcl.h
   trunk/varnish-cache/include/varnishapi.h
   trunk/varnish-cache/include/vin.h
   trunk/varnish-cache/lib/libvarnish/vin.c
   trunk/varnish-cache/lib/libvarnishapi/vsl_api.h
   trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c
   trunk/varnish-cache/lib/libvarnishapi/vsm.c
   trunk/varnish-cache/lib/libvcl/vcc_backend.c
   trunk/varnish-cache/lib/libvcl/vcc_compile.c
   trunk/varnish-cache/lib/libvcl/vcc_compile.h
Log:
Remove the -L option stuff, it will not be needed for docs.



Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -336,15 +336,7 @@
 	/* XXX: annotate vcl with -b/-f arg so people know where it came from */
 	(void)f_arg;
 
-	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) {
+	if (b_arg != NULL) {
 		AZ(vcl);
 		/*
 		 * XXX: should do a "HEAD /" on the -b argument to see that
@@ -456,7 +448,7 @@
 mgt_vcc_init(void)
 {
 
-	VCC_InitCompile(default_vcl, L_arg);
+	VCC_InitCompile(default_vcl);
 	AZ(atexit(mgt_vcc_atexit));
 }
 

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -84,7 +84,6 @@
 struct vev_base		*mgt_evb;
 int			exit_status = 0;
 struct vsb		*vident;
-unsigned		L_arg = 0;
 
 static void
 build_vident(void)
@@ -365,7 +364,6 @@
 	struct cli cli[1];
 	struct pidfh *pfh = NULL;
 	char *dirname;
-	char tmpbuf[128];
 
 	/*
 	 * Start out by closing all unwanted file descriptors we might
@@ -460,20 +458,6 @@
 		case 'l':
 			l_arg = optarg;
 			break;
-		case 'L':
-			L_arg = strtoul(optarg, NULL, 0);
-			if (!VIN_L_OK(L_arg)) {
-				fprintf(stderr, "%s\n", VIN_L_MSG);
-				exit (1);
-			}
-			d_flag++;
-			n_arg = vin_L_arg(L_arg);
-			MCF_ParamSet(cli, "ping_interval", "0");
-
-			bprintf(tmpbuf, "127.0.0.1:%u", L_arg);
-			MCF_ParamSet(cli, "listen_address", tmpbuf);
-
-			break;
 		case 'M':
 			M_arg = optarg;
 			break;
@@ -532,14 +516,6 @@
 
 	mgt_vcc_init();
 
-	if (L_arg) {
-		/* Learner mode */
-		if (!s_arg_given) {
-			STV_config("malloc,1m");
-			s_arg_given = 1;
-		}
-	}
-
 	if (argc != 0) {
 		fprintf(stderr, "Too many arguments (%s...)\n", argv[0]);
 		usage();
@@ -611,7 +587,7 @@
 		exit(1);
 	}
 
-	if (b_arg != NULL || f_arg != NULL || L_arg > 0)
+	if (b_arg != NULL || f_arg != NULL)
 		if (mgt_vcc_default(b_arg, f_arg, vcl, C_flag))
 			exit (2);
 
@@ -654,10 +630,6 @@
 		mgt_cli_master(M_arg);
 	if (T_arg != NULL)
 		mgt_cli_telnet(T_arg);
-	else if (L_arg > 0) {
-		bprintf(tmpbuf, "127.0.0.1:%u", L_arg + 1);
-		mgt_cli_telnet(tmpbuf);
-	}
 
 	STV_ready();	/* Complete initialization */
 

Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c
===================================================================
--- trunk/varnish-cache/bin/varnishstat/varnishstat.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishstat/varnishstat.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -206,9 +206,6 @@
 		case '1':
 			once = 1;
 			break;
-		case 'f':
-			(void)VSC_Arg(vd, c, optarg);
-			break;
 		case 'l':
 			if (VSC_Open(vd, 1))
 				exit(1);

Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -64,8 +64,6 @@
 static pthread_mutex_t	vtc_mtx;
 static pthread_cond_t	vtc_cond;
 
-int			vtc_learn = 0;
-
 /**********************************************************************
  * Macro facility
  */
@@ -119,11 +117,9 @@
 		va_end(ap);
 		m->val = strdup(buf2);
 		AN(m->val);
-		if (!vtc_learn)
-			vtc_log(vl, 4, "macro def %s=%s", name, m->val);
+		vtc_log(vl, 4, "macro def %s=%s", name, m->val);
 	} else if (m != NULL) {
-		if (!vtc_learn)
-			vtc_log(vl, 4, "macro undef %s", name);
+		vtc_log(vl, 4, "macro undef %s", name);
 		VTAILQ_REMOVE(&macro_list, m, list);
 		free(m->name);
 		free(m->val);
@@ -623,17 +619,6 @@
 	AN(vltop);
 	while ((ch = getopt(argc, argv, "L:n:qt:v")) != -1) {
 		switch (ch) {
-		case 'L':
-			/* XXX: append "/tutorial" to default search path */
-			vtc_learn = strtoul(optarg, NULL, 0);
-			if (vtc_learn > 65000) {
-				fprintf(stderr,
-				    "-L argument must be 1...65000\n");
-				exit(1);
-			}
-			vtc_verbosity += 2;
-			dur = 60 * 3;	/* seconds */
-			break;
 		case 'n':
 			ntest = strtoul(optarg, NULL, 0);
 			break;

Modified: trunk/varnish-cache/bin/varnishtest/vtc.h
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.h	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishtest/vtc.h	2010-06-14 08:40:04 UTC (rev 4954)
@@ -53,7 +53,6 @@
 cmd_f cmd_varnish;
 cmd_f cmd_sema;
 
-extern int vtc_learn;		/* Non-zero in Learners mode */
 extern int vtc_verbosity;
 extern int vtc_error;		/* Error, bail out */
 extern int vtc_stop;		/* Abandon current test, no error */

Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_client.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishtest/vtc_client.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -136,10 +136,7 @@
 	if (*c->name != 'c')
 		vtc_log(c->vl, 0, "Client name must start with 'c'");
 
-	if (vtc_learn)
-		bprintf(c->connect, "127.0.0.1:%d", vtc_learn);
-	else
-		bprintf(c->connect, "%s", "${v1_sock}");
+	bprintf(c->connect, "%s", "${v1_sock}");
 	VTAILQ_INSERT_TAIL(&clients, c, list);
 	return (c);
 }
@@ -183,8 +180,7 @@
 	void *res;
 
 	CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC);
-	if (!vtc_learn)
-		vtc_log(c->vl, 2, "Waiting for client");
+	vtc_log(c->vl, 2, "Waiting for client");
 	AZ(pthread_join(c->tp, &res));
 	if (res != NULL)
 		vtc_log(c->vl, 0, "Client returned \"%s\"", (char *)res);
@@ -242,11 +238,7 @@
 		if (vtc_error)
 			break;
 		if (!strcmp(*av, "-connect")) {
-			if (vtc_learn)
-				bprintf(c->connect, "127.0.0.1:%d",
-				    vtc_learn + atoi(av[1]));
-			else
-				bprintf(c->connect, "%s", av[1]);
+			bprintf(c->connect, "%s", av[1]);
 			av++;
 			continue;
 		}

Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -915,10 +915,7 @@
 	ALLOC_OBJ(hp, HTTP_MAGIC);
 	AN(hp);
 	hp->fd = sock;
-	if (vtc_learn)
-		hp->timeout = 120 * 1000;
-	else
-		hp->timeout = 3000;
+	hp->timeout = 3000;
 	hp->nrxbuf = 640*1024;
 	hp->vsb = vsb_newauto();
 	hp->rxbuf = malloc(hp->nrxbuf);		/* XXX */

Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_server.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishtest/vtc_server.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -137,10 +137,7 @@
 	if (*s->name != 's')
 		vtc_log(s->vl, 0, "Server name must start with 's'");
 
-	if (vtc_learn)
-		bprintf(s->listen, "127.0.0.1:%d", vtc_learn + 10);
-	else
-		bprintf(s->listen, "127.0.0.1:%d", 0);
+	bprintf(s->listen, "127.0.0.1:%d", 0);
 	AZ(VSS_parse(s->listen, &s->addr, &s->port));
 	s->repeat = 1;
 	s->depth = 1;
@@ -174,8 +171,7 @@
 	int naddr;
 
 	CHECK_OBJ_NOTNULL(s, SERVER_MAGIC);
-	if (!vtc_learn)
-		vtc_log(s->vl, 2, "Starting server");
+	vtc_log(s->vl, 2, "Starting server");
 	if (s->sock < 0) {
 		naddr = VSS_resolve(s->addr, s->port, &s->vss_addr);
 		if (naddr != 1)
@@ -194,8 +190,7 @@
 		if (!strcmp(s->port, "0"))
 			REPLACE(s->port, s->aport);
 	}
-	if (!vtc_learn)
-		vtc_log(s->vl, 1, "Listen on %s:%s", s->addr, s->port);
+	vtc_log(s->vl, 1, "Listen on %s:%s", s->addr, s->port);
 	s->run = 1;
 	AZ(pthread_create(&s->tp, NULL, server_thread, s));
 }
@@ -210,8 +205,7 @@
 	void *res;
 
 	CHECK_OBJ_NOTNULL(s, SERVER_MAGIC);
-	if (!vtc_learn)
-		vtc_log(s->vl, 2, "Waiting for server");
+	vtc_log(s->vl, 2, "Waiting for server");
 	AZ(pthread_join(s->tp, &res));
 	if (res != NULL && !vtc_stop)
 		vtc_log(s->vl, 0, "Server returned \"%p\"",
@@ -300,11 +294,7 @@
 			continue;
 		}
 		if (!strcmp(*av, "-listen")) {
-			if (vtc_learn)
-				bprintf(s->listen, "127.0.0.1:%d",
-				    vtc_learn + 10 + atoi(av[1]));
-			else
-				bprintf(s->listen, "%s", av[1]);
+			bprintf(s->listen, "%s", av[1]);
 			AZ(VSS_parse(s->listen, &s->addr, &s->port));
 			av++;
 			continue;

Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -459,7 +459,7 @@
 	AZ(close(v->cli_fd));
 	v->cli_fd = -1;
 
-	AZ(close(v->fds[1]));
+	(void)close(v->fds[1]);		/* May already have been closed */
 
 	AZ(pthread_join(v->tp, &p));
 	AZ(close(v->fds[0]));

Modified: trunk/varnish-cache/include/libvcl.h
===================================================================
--- trunk/varnish-cache/include/libvcl.h	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/include/libvcl.h	2010-06-14 08:40:04 UTC (rev 4954)
@@ -30,6 +30,6 @@
  */
 
 char *VCC_Compile(struct vsb *sb, const char *b, const char *e);
-void VCC_InitCompile(const char *default_vcl, unsigned L_arg);
+void VCC_InitCompile(const char *default_vcl);
 const char *VCC_Return_Name(unsigned action);
 

Modified: trunk/varnish-cache/include/varnishapi.h
===================================================================
--- trunk/varnish-cache/include/varnishapi.h	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/include/varnishapi.h	2010-06-14 08:40:04 UTC (rev 4954)
@@ -150,7 +150,7 @@
 	 * Setup vd for use with VSC functions.
 	 */
 
-#define VSC_ARGS	"L:n:"
+#define VSC_ARGS	"f:n:"
 #define VSC_n_USAGE	VSM_n_USAGE
 #define VSC_USAGE	VSC_N_USAGE
 
@@ -210,7 +210,7 @@
 	 * 	!= 0 on failure
 	 */
 	
-#define VSL_ARGS	"bCcdI:i:k:L:n:r:s:X:x:"
+#define VSL_ARGS	"bCcdI:i:k:n:r:s:X:x:"
 #define VSL_b_USAGE	"[-b]"
 #define VSL_c_USAGE	"[-c]"
 #define VSL_C_USAGE	"[-C]"

Modified: trunk/varnish-cache/include/vin.h
===================================================================
--- trunk/varnish-cache/include/vin.h	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/include/vin.h	2010-06-14 08:40:04 UTC (rev 4954)
@@ -35,10 +35,4 @@
 
 /* This function lives in both libvarnish and libvarnishapi */
 int vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl);
-char *vin_L_arg(unsigned L_arg);
-#define VIN_L_LOW	1024
-#define VIN_L_HIGH	65000
-#define VIN_L_OK(a)	(a >= VIN_L_LOW && a <= VIN_L_HIGH)
-#define VIN_L_MSG	"-L argument must be [1024...65000]"
-
 #endif

Modified: trunk/varnish-cache/lib/libvarnish/vin.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vin.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvarnish/vin.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -101,13 +101,3 @@
 	}
 	return (0);
 }
-
-char *
-vin_L_arg(unsigned L_arg)
-{
-	char p[PATH_MAX];
-
-	assert(VIN_L_OK(L_arg));
-	bprintf(p, "/tmp/varnish_L_%u", L_arg);
-	return (strdup(p));
-}

Modified: trunk/varnish-cache/lib/libvarnishapi/vsl_api.h
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl_api.h	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl_api.h	2010-06-14 08:40:04 UTC (rev 4954)
@@ -46,7 +46,6 @@
 	unsigned		rbuflen;
 	uint32_t		*rbuf;
 
-	unsigned		L_opt;
 	int			b_opt;
 	int			c_opt;
 	int			d_opt;

Modified: trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl_arg.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -210,16 +210,6 @@
 	case 's': return (vsl_s_arg(vd, opt));
 	case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg));
 	case 'C': vd->vsl->regflags = VRE_CASELESS; return (1);
-	case 'L':
-		vd->vsl->L_opt = strtoul(opt, NULL, 0);
-		if (vd->vsl->L_opt < 1024 || vd->vsl->L_opt > 65000) {
-			fprintf(stderr, "%s\n", VIN_L_MSG);
-			exit (1);
-		}
-		free(vd->n_opt);
-		vd->n_opt = vin_L_arg(vd->vsl->L_opt);
-		assert(vd->n_opt != NULL);
-		return (1);
 	default:
 		return (0);
 	}

Modified: trunk/varnish-cache/lib/libvarnishapi/vsm.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsm.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvarnishapi/vsm.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -213,7 +213,8 @@
 {
 
 	CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
-	AN(vd->vsm_head);
+	if (vd->vsm_head == NULL)
+		return;
 	assert(0 == munmap((void*)vd->vsm_head, vd->vsm_head->shm_size));
 	vd->vsm_head = NULL;
 	assert(vd->vsm_fd >= 0);

Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -393,9 +393,7 @@
 	struct fld_spec *fs;
 	struct vsb *vsb;
 	unsigned u;
-	unsigned tL_port = 0;
 	double t;
-	char tmpbuf[20];
 
 	Fh(tl, 1, "\n#define VGC_backend_%s %d\n", vgcname, tl->ndirector);
 
@@ -449,39 +447,10 @@
 			vcc_NextToken(tl);
 			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "port")) {
-			if (Learn_mode) {
-				ExpectErr(tl, ID);
-				if (!vcc_IdIs(tl->t, "Learn")) {
-					vsb_printf(tl->sb,
-					    "Expected \"Learn\"\n");
-					vcc_ErrToken(tl, tl->t);
-					vcc_ErrWhere(tl, tl->t);
-					return;
-				}
-				vcc_NextToken(tl);
-
-				ExpectErr(tl, '(');
-				vcc_NextToken(tl);
-
-				ExpectErr(tl, CNUM);
-				t_port = tl->t;
-				tL_port = vcc_UintVal(tl);
-				if (tL_port > 9) {
-					vsb_printf(tl->sb,
-					    "Learn port > 9\n");
-					vcc_ErrToken(tl, t_port);
-					vcc_ErrWhere(tl, t_port);
-					return;
-				}
-
-				ExpectErr(tl, ')');
-				vcc_NextToken(tl);
-			} else {
-				ExpectErr(tl, CSTR);
-				assert(tl->t->dec != NULL);
-				t_port = tl->t;
-				vcc_NextToken(tl);
-			}
+			ExpectErr(tl, CSTR);
+			assert(tl->t->dec != NULL);
+			t_port = tl->t;
+			vcc_NextToken(tl);
 			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "host_header")) {
 			ExpectErr(tl, CSTR);
@@ -550,10 +519,7 @@
 	}
 
 	/* Check that the portname makes sense */
-	if (Learn_mode && t_port != NULL && t_port->tok == CNUM) {
-		bprintf(tmpbuf, "%u", Learn_mode + 10 + tL_port);
-		Emit_Sockaddr(tl, t_host, tmpbuf);
-	} else if (t_port != NULL) {
+	if (t_port != NULL) {
 		ep = CheckHostPort("127.0.0.1", t_port->dec);
 		if (ep != NULL) {
 			vsb_printf(tl->sb,

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.c	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.c	2010-06-14 08:40:04 UTC (rev 4954)
@@ -86,8 +86,6 @@
 
 static const char *vcc_default_vcl_b, *vcc_default_vcl_e;
 
-unsigned Learn_mode = 0;
-
 /*--------------------------------------------------------------------*/
 
 static void
@@ -675,10 +673,9 @@
  */
 
 void
-VCC_InitCompile(const char *default_vcl, unsigned L_arg)
+VCC_InitCompile(const char *default_vcl)
 {
 
-	Learn_mode = L_arg;
 	vcc_default_vcl_b = default_vcl;
 	vcc_default_vcl_e = strchr(default_vcl, '\0');
 	assert(vcc_default_vcl_e != NULL);

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.h	2010-06-14 08:03:45 UTC (rev 4953)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.h	2010-06-14 08:40:04 UTC (rev 4954)
@@ -163,7 +163,6 @@
 
 /* vcc_compile.c */
 extern struct method method_tab[];
-extern unsigned Learn_mode;
 /*
  * H -> Header, before the C code
  * C -> C-code




More information about the varnish-commit mailing list