Browse Source

api: allow -b <ip>, and set bind retry to 20sec

before, only -b <ip:port>, <port> or 0 (disable) was allowed

easier to set -b 0.0.0.0 with default port
master
Tanguy Pruvot 10 years ago
parent
commit
d09ec41251
  1. 4
      api.cpp
  2. 11
      ccminer.cpp

4
api.cpp

@ -750,8 +750,8 @@ static void api() @@ -750,8 +750,8 @@ static void api()
break;
else {
if (!opt_quiet || opt_debug)
applog(LOG_WARNING, "API bind to port %d failed - trying again in 15sec", port);
sleep(15);
applog(LOG_WARNING, "API bind to port %d failed - trying again in 20sec", port);
sleep(20);
}
}
else

11
ccminer.cpp

@ -1734,7 +1734,7 @@ static void show_usage_and_exit(int status) @@ -1734,7 +1734,7 @@ static void show_usage_and_exit(int status)
static void parse_arg(int key, char *arg)
{
char *p;
char *p = arg;
int v, i;
double d;
@ -1761,8 +1761,15 @@ static void parse_arg(int key, char *arg) @@ -1761,8 +1761,15 @@ static void parse_arg(int key, char *arg)
}
opt_api_listen = atoi(p + 1);
}
else if (arg)
else if (arg && strstr(arg, ".")) {
/* ip only */
free(opt_api_allow);
opt_api_allow = strdup(arg);
}
else if (arg) {
/* port or 0 to disable */
opt_api_listen = atoi(arg);
}
break;
case 'B':
opt_background = true;

Loading…
Cancel
Save