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

3
src/ckpool.h

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

Loading…
Cancel
Save