r2826 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Jun 26 13:15:22 CEST 2008


Author: phk
Date: 2008-06-26 13:15:22 +0200 (Thu, 26 Jun 2008)
New Revision: 2826

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/bin/varnishd/common.h
   trunk/varnish-cache/bin/varnishd/mgt_param.c
Log:
Allow the selector to be chosen by parameter "acceptor"



Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2008-06-26 10:41:56 UTC (rev 2825)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2008-06-26 11:15:22 UTC (rev 2826)
@@ -309,8 +309,9 @@
 	(void)cli;
 	(void)av;
 	(void)priv;
-	/* XXX: Add selector mechanism at some point */
-	vca_act = vca_acceptors[0];
+	
+	if (vca_act == NULL)
+		vca_act = vca_acceptors[0];
 
 	AN(vca_act);
 	AN(vca_act->name);
@@ -333,3 +334,35 @@
 
 	CLI_AddFuncs(MASTER_CLI, vca_cmds);
 }
+
+void
+VCA_tweak_acceptor(struct cli *cli, const char *arg)
+{
+	int i;
+
+	if (arg == NULL) {
+		if (vca_act == NULL)
+			cli_out(cli, "default");
+		else
+			cli_out(cli, "%s", vca_act->name);
+		
+		cli_out(cli, " (");
+		for (i = 0; vca_acceptors[i] != NULL; i++)
+			cli_out(cli, "%s%s", i == 0 ? "" : ", ",
+			    vca_acceptors[i]->name);
+		cli_out(cli, ")");
+		return;
+	}
+	if (!strcmp(arg, "default")) {
+		vca_act = NULL;
+		return;
+	} 
+	for (i = 0; vca_acceptors[i]->name; i++) {
+		if (!strcmp(arg, vca_acceptors[i]->name)) {
+			vca_act = vca_acceptors[i];
+			return;
+		}
+	}
+	cli_out(cli, "Unknown acceptor");
+	cli_result(cli, CLIS_PARAM);
+}

Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h	2008-06-26 10:41:56 UTC (rev 2825)
+++ trunk/varnish-cache/bin/varnishd/common.h	2008-06-26 11:15:22 UTC (rev 2826)
@@ -32,6 +32,10 @@
 struct cli;
 struct sockaddr;
 
+/* cache_acceptor.c */
+void VCA_tweak_acceptor(struct cli *cli, const char *arg);
+
+
 /* shmlog.c */
 void VSL_MgtInit(const char *fn, unsigned size);
 extern struct varnish_stats *VSL_stats;

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c	2008-06-26 10:41:56 UTC (rev 2825)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c	2008-06-26 11:15:22 UTC (rev 2826)
@@ -405,6 +405,17 @@
 /*--------------------------------------------------------------------*/
 
 static void
+tweak_acceptor(struct cli *cli, const struct parspec *par, const char *arg)
+{
+
+	/* XXX should have tweak_generic_string */
+	(void)par;
+	VCA_tweak_acceptor(cli, arg);
+}
+
+/*--------------------------------------------------------------------*/
+
+static void
 tweak_diag_bitmap(struct cli *cli, const struct parspec *par, const char *arg)
 {
 	unsigned u;
@@ -752,6 +763,10 @@
 		"SessionOpen shared memory record.\n",
 		0,
 		"off", "bool" },
+	{ "acceptor", tweak_acceptor, NULL, 0, 0,
+		"Select the acceptor kernel interface.\n",
+		EXPERIMENTAL | MUST_RESTART,
+		"default", NULL },
 	{ "diag_bitmap", tweak_diag_bitmap, 0, 0, 0,
 		"Bitmap controlling diagnostics code:\n"
 		"  0x00000001 - CNT_Session states.\n"




More information about the varnish-commit mailing list