Browse Source

api: change api bind variable name

pull/2/head
Tanguy Pruvot 8 years ago
parent
commit
b372729ce6
  1. 3
      api.cpp
  2. 15
      ccminer.cpp

3
api.cpp

@ -90,6 +90,7 @@ static char *buffer = NULL; @@ -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;
@ -794,7 +795,7 @@ static bool check_connect(struct sockaddr_in *cli, char **connectaddr, char *gro @@ -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;

15
ccminer.cpp

@ -213,7 +213,8 @@ int opt_statsavg = 30; @@ -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 */
@ -576,7 +577,7 @@ void proper_exit(int reason) @@ -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);
@ -2972,16 +2973,16 @@ void parse_arg(int key, char *arg) @@ -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 */

Loading…
Cancel
Save