Browse Source

Add options for supporting a passthrough node

master
Con Kolivas 10 years ago
parent
commit
69124695cc
  1. 25
      src/ckpool.c
  2. 3
      src/ckpool.h

25
src/ckpool.c

@ -1472,6 +1472,7 @@ static struct option long_options[] = {
{"killold", no_argument, 0, 'k'},
{"log-shares", no_argument, 0, 'L'},
{"loglevel", required_argument, 0, 'l'},
{"node", no_argument, 0, 'N'},
{"name", required_argument, 0, 'n'},
{"passthrough", no_argument, 0, 'P'},
{"proxy", no_argument, 0, 'p'},
@ -1490,6 +1491,7 @@ static struct option long_options[] = {
{"killold", no_argument, 0, 'k'},
{"log-shares", no_argument, 0, 'L'},
{"loglevel", required_argument, 0, 'l'},
{"node", no_argument, 0, 'N'},
{"name", required_argument, 0, 'n'},
{"passthrough", no_argument, 0, 'P'},
{"proxy", no_argument, 0, 'p'},
@ -1537,7 +1539,7 @@ int main(int argc, char **argv)
ckp.initial_args[ckp.args] = strdup(argv[ckp.args]);
ckp.initial_args[ckp.args] = NULL;
while ((c = getopt_long(argc, argv, "Ac:Dd:g:HhkLl:n:PpRS:s:", long_options, &i)) != -1) {
while ((c = getopt_long(argc, argv, "Ac:Dd:g:HhkLl:Nn:PpRS:s:", long_options, &i)) != -1) {
switch (c) {
case 'A':
ckp.standalone = true;
@ -1588,22 +1590,27 @@ int main(int argc, char **argv)
LOG_EMERG, LOG_DEBUG, ckp.loglevel);
}
break;
case 'N':
if (ckp.proxy || ckp.redirector || ckp.passthrough)
quit(1, "Cannot set combinations of proxy, node, redirector and passthrough");
ckp.standalone = ckp.node = ckp.proxy = ckp.passthrough = true;
break;
case 'n':
ckp.name = optarg;
break;
case 'P':
if (ckp.proxy || ckp.redirector)
quit(1, "Cannot set both proxy or redirector and passthrough mode");
if (ckp.node || ckp.proxy || ckp.redirector)
quit(1, "Cannot set combinations of proxy, node, redirector and passthrough");
ckp.standalone = ckp.proxy = ckp.passthrough = true;
break;
case 'p':
if (ckp.passthrough || ckp.redirector)
quit(1, "Cannot set both passthrough or redirector and proxy mode");
if (ckp.node || ckp.passthrough || ckp.redirector)
quit(1, "Cannot set combinations of proxy, node, redirector and passthrough");
ckp.proxy = true;
break;
case 'R':
if (ckp.proxy || ckp.passthrough)
quit(1, "Cannot set both proxy or passthrough and redirector modes");
if (ckp.node || ckp.proxy || ckp.passthrough)
quit(1, "Cannot set combinations of proxy, node, redirector and passthrough");
ckp.standalone = ckp.proxy = ckp.passthrough = ckp.redirector = true;
break;
case 'S':
@ -1616,7 +1623,9 @@ int main(int argc, char **argv)
}
if (!ckp.name) {
if (ckp.redirector)
if (ckp.node)
ckp.name = "cknode";
else if (ckp.redirector)
ckp.name = "ckredirector";
else if (ckp.passthrough)
ckp.name = "ckpassthrough";

3
src/ckpool.h

@ -180,6 +180,9 @@ struct ckpool_instance {
/* Are we a redirecting passthrough */
bool redirector;
/* Are we a relay node passthrough */
bool node;
/* Are we running as a proxy */
bool proxy;

Loading…
Cancel
Save