Browse Source

api: change api bind variable name

master
Tanguy Pruvot 7 years ago
parent
commit
b372729ce6
  1. 3
      api.cpp
  2. 15
      ccminer.cpp

3
api.cpp

@ -90,6 +90,7 @@ static char *buffer = NULL;
static time_t startup = 0; static time_t startup = 0;
static int bye = 0; static int bye = 0;
extern char *opt_api_bind;
extern char *opt_api_allow; extern char *opt_api_allow;
extern int opt_api_listen; /* port */ extern int opt_api_listen; /* port */
extern int opt_api_remote; extern int opt_api_remote;
@ -794,7 +795,7 @@ static bool check_connect(struct sockaddr_in *cli, char **connectaddr, char *gro
static void api() static void api()
{ {
const char *addr = opt_api_allow; const char *addr = opt_api_bind;
unsigned short port = (unsigned short) opt_api_listen; // 4068 unsigned short port = (unsigned short) opt_api_listen; // 4068
char buf[MYBUFSIZ]; char buf[MYBUFSIZ];
int n, bound; int n, bound;

15
ccminer.cpp

@ -213,7 +213,8 @@ int opt_statsavg = 30;
// strdup on char* to allow a common free() if used // strdup on char* to allow a common free() if used
static char* opt_syslog_pfx = strdup(PROGRAM_NAME); 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_remote = 0;
int opt_api_listen = 4068; /* 0 to disable */ int opt_api_listen = 4068; /* 0 to disable */
@ -576,7 +577,7 @@ void proper_exit(int reason)
} }
#endif #endif
free(opt_syslog_pfx); free(opt_syslog_pfx);
free(opt_api_allow); free(opt_api_bind);
//free(work_restart); //free(work_restart);
//free(thr_info); //free(thr_info);
exit(reason); exit(reason);
@ -2972,16 +2973,16 @@ void parse_arg(int key, char *arg)
if (p) { if (p) {
/* ip:port */ /* ip:port */
if (p - arg > 0) { if (p - arg > 0) {
free(opt_api_allow); free(opt_api_bind);
opt_api_allow = strdup(arg); opt_api_bind = strdup(arg);
opt_api_allow[p - arg] = '\0'; opt_api_bind[p - arg] = '\0';
} }
opt_api_listen = atoi(p + 1); opt_api_listen = atoi(p + 1);
} }
else if (arg && strstr(arg, ".")) { else if (arg && strstr(arg, ".")) {
/* ip only */ /* ip only */
free(opt_api_allow); free(opt_api_bind);
opt_api_allow = strdup(arg); opt_api_bind = strdup(arg);
} }
else if (arg) { else if (arg) {
/* port or 0 to disable */ /* port or 0 to disable */

Loading…
Cancel
Save