|
@@ -137,6 +137,7 @@ static const char *algo_names[] = { |
|
|
|
|
|
bool opt_debug = false; |
|
|
bool opt_protocol = false; |
|
|
static bool opt_keepalive = false ; |
|
|
static bool opt_benchmark = false; |
|
|
bool opt_redirect = true; |
|
|
bool want_longpoll = true; |
|
@@ -207,6 +208,7 @@ Options:\n\ |
|
|
--cert=FILE certificate for mining server using SSL\n\ |
|
|
-x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy\n\ |
|
|
-t, --threads=N number of miner threads (default: number of processors)\n\ |
|
|
-k, --keepalive Send keepalived for prevent timeout (need pool support features)\n\ |
|
|
-r, --retries=N number of times to retry if a network call fails\n\ |
|
|
(default: retry indefinitely)\n\ |
|
|
-R, --retry-pause=N time to pause between retries, in seconds (default: 30)\n\ |
|
@@ -241,7 +243,7 @@ static char const short_options[] = |
|
|
#ifdef HAVE_SYSLOG_H |
|
|
"S" |
|
|
#endif |
|
|
"a:c:Dhp:Px:qr:R:s:t:T:o:u:O:V"; |
|
|
"a:c:Dhp:Px:kqr:R:s:t:T:o:u:O:V"; |
|
|
|
|
|
static struct option const options[] = { |
|
|
{ "algo", 1, NULL, 'a' }, |
|
@@ -253,6 +255,7 @@ static struct option const options[] = { |
|
|
{ "config", 1, NULL, 'c' }, |
|
|
{ "debug", 0, NULL, 'D' }, |
|
|
{ "help", 0, NULL, 'h' }, |
|
|
{ "keepalive" , 0 , NULL ,'k'}, |
|
|
{ "no-longpoll", 0, NULL, 1003 }, |
|
|
{ "no-redirect", 0, NULL, 1009 }, |
|
|
{ "no-stratum", 0, NULL, 1007 }, |
|
@@ -1047,7 +1050,6 @@ static void *miner_thread(void *userdata) { |
|
|
thr_id % num_processors); |
|
|
affine_to_cpu(thr_id, thr_id % num_processors); |
|
|
}*/ |
|
|
|
|
|
persistentctx = persistentctxs[thr_id]; |
|
|
if(!persistentctx && opt_algo == ALGO_CRYPTONIGHT) |
|
|
{ |
|
@@ -1328,8 +1330,12 @@ static bool stratum_handle_response(char *buf) { |
|
|
|
|
|
if(jsonrpc_2) { |
|
|
json_t *status = json_object_get(res_val, "status"); |
|
|
const char *s = json_string_value(status); |
|
|
if ( !strcmp(s, "KEEPALIVED") ) { |
|
|
applog(LOG_INFO, "Keepalived receveid"); |
|
|
goto out; |
|
|
} |
|
|
if(status) { |
|
|
const char *s = json_string_value(status); |
|
|
valid = !strcmp(s, "OK") && json_is_null(err_val); |
|
|
} else { |
|
|
valid = json_is_null(err_val); |
|
@@ -1405,11 +1411,14 @@ static void *stratum_thread(void *userdata) { |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if (!stratum_socket_full(&stratum, 600)) { |
|
|
applog(LOG_ERR, "Stratum connection timed out"); |
|
|
s = NULL; |
|
|
} else |
|
|
if ( opt_keepalive && !stratum_socket_full(&stratum, 90)) { |
|
|
applog(LOG_INFO, "Keepalived send...."); |
|
|
stratum_keepalived(&stratum,rpc2_id); |
|
|
} |
|
|
if (!stratum_socket_full(&stratum, 300)) { |
|
|
applog(LOG_ERR, "Stratum connection timed out"); |
|
|
s = NULL; |
|
|
} else |
|
|
s = stratum_recv_line(&stratum); |
|
|
if (!s) { |
|
|
stratum_disconnect(&stratum); |
|
|
0 comments on commit
0c8aedb