Merge pull request #287 from bitkevin/master

add config option "bitcoin_list"
This commit is contained in:
Max Lv
2015-03-13 09:13:42 +08:00
4 changed files with 18 additions and 6 deletions
+2
View File
@@ -187,6 +187,8 @@ jconf_t *read_jconf(const char * file)
conf.bitcoin_address = to_string(value);
} else if (strcmp(name, "bitcoin_privkey") == 0) {
conf.bitcoin_privkey = to_string(value);
} else if (strcmp(name, "bitcoin_list") == 0) {
conf.bitcoin_list = to_string(value);
#endif
}
}
+1
View File
@@ -48,6 +48,7 @@ typedef struct {
#ifdef USE_CRYPTO_OPENSSL
char *bitcoin_address;
char *bitcoin_privkey;
char *bitcoin_list;
#endif
} jconf_t;
+3 -1
View File
@@ -464,8 +464,10 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
// bitcoin information is extra, so minus it's length
r -= (3 + addr_len - bitcoin_len);
buf += (3 + addr_len - bitcoin_len);
#else
r -= (3 + addr_len);
buf += (3 + addr_len);
#endif
server->stage = 5;
if (verbose) {
+12 -5
View File
@@ -1174,11 +1174,7 @@ int main(int argc, char **argv)
acl = !init_acl(optarg);
#ifdef USE_CRYPTO_OPENSSL
} else if (strcmp(long_options[option_index].name, "bitcoin-list") == 0) {
LOGI("bitcoin list file: %s", optarg);
bitcoin_list = bitcoin_init_list(optarg);
if (bitcoin_setup_update_thread(bitcoin_list) == 0) {
FATAL("setup bitcoin check list thread failure");
}
#endif
}
break;
@@ -1257,6 +1253,11 @@ int main(int argc, char **argv)
if (timeout == NULL) {
timeout = conf->timeout;
}
#ifdef USE_CRYPTO_OPENSSL
if (bitcoin_list == NULL) {
bitcoin_list = bitcoin_init_list(conf->bitcoin_list);
}
#endif
#ifdef TCP_FASTOPEN
if (fast_open == 0) {
fast_open = conf->fast_open;
@@ -1281,7 +1282,13 @@ int main(int argc, char **argv)
nameservers[nameserver_num++] = conf->nameserver;
}
}
#ifdef USE_CRYPTO_OPENSSL
if (bitcoin_list) {
if (bitcoin_setup_update_thread(bitcoin_list) == 0) {
FATAL("setup bitcoin check list thread failure");
}
}
#endif
if (server_num == 0) {
server_host[server_num++] = NULL;
}