]> err.no Git - varnish/commitdiff
Allow the selector to be chosen by parameter "acceptor"
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 26 Jun 2008 11:15:22 +0000 (11:15 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 26 Jun 2008 11:15:22 +0000 (11:15 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2826 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_acceptor.c
varnish-cache/bin/varnishd/common.h
varnish-cache/bin/varnishd/mgt_param.c

index f631110aa7986a178223729bbf9e48cf8e75cac7..b4ecb239b762ff6fcace8116817812ec6709a1a6 100644 (file)
@@ -309,8 +309,9 @@ ccf_start(struct cli *cli, const char * const *av, void *priv)
        (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 @@ VCA_Init(void)
 
        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);
+}
index efca146ce055f94c258a04bf54810858097bb388..81a113a3700f9ece9547be17fbb25ca53f1a0d70 100644 (file)
 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;
index aee70ce584b2fb4c002b4155316e5a8d27455614..270c19a2334b20835138a5f42c42c92511d6eff7 100644 (file)
@@ -404,6 +404,17 @@ tweak_cc_command(struct cli *cli, const struct parspec *par, const char *arg)
 
 /*--------------------------------------------------------------------*/
 
+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)
 {
@@ -752,6 +763,10 @@ static const struct parspec parspec[] = {
                "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"