Skip to content

Commit

Permalink
api: change api bind variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed May 16, 2017
1 parent 857c181 commit b372729
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ static char *buffer = NULL;
static time_t startup = 0;
static int bye = 0;

extern char *opt_api_bind;
extern char *opt_api_allow;
extern int opt_api_listen; /* port */
extern int opt_api_remote;
Expand Down Expand Up @@ -794,7 +795,7 @@ static bool check_connect(struct sockaddr_in *cli, char **connectaddr, char *gro

static void api()
{
const char *addr = opt_api_allow;
const char *addr = opt_api_bind;
unsigned short port = (unsigned short) opt_api_listen; // 4068
char buf[MYBUFSIZ];
int n, bound;
Expand Down
15 changes: 8 additions & 7 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ int opt_statsavg = 30;

// strdup on char* to allow a common free() if used
static char* opt_syslog_pfx = strdup(PROGRAM_NAME);
char *opt_api_allow = strdup("127.0.0.1"); /* 0.0.0.0 for all ips */
char *opt_api_bind = strdup("127.0.0.1"); /* 0.0.0.0 for all ips */
char *opt_api_allow = NULL; /* unimplemented */
int opt_api_remote = 0;
int opt_api_listen = 4068; /* 0 to disable */

Expand Down Expand Up @@ -576,7 +577,7 @@ void proper_exit(int reason)
}
#endif
free(opt_syslog_pfx);
free(opt_api_allow);
free(opt_api_bind);
//free(work_restart);
//free(thr_info);
exit(reason);
Expand Down Expand Up @@ -2972,16 +2973,16 @@ void parse_arg(int key, char *arg)
if (p) {
/* ip:port */
if (p - arg > 0) {
free(opt_api_allow);
opt_api_allow = strdup(arg);
opt_api_allow[p - arg] = '\0';
free(opt_api_bind);
opt_api_bind = strdup(arg);
opt_api_bind[p - arg] = '\0';
}
opt_api_listen = atoi(p + 1);
}
else if (arg && strstr(arg, ".")) {
/* ip only */
free(opt_api_allow);
opt_api_allow = strdup(arg);
free(opt_api_bind);
opt_api_bind = strdup(arg);
}
else if (arg) {
/* port or 0 to disable */
Expand Down

0 comments on commit b372729

Please sign in to comment.