Browse Source

Restore default timeout (300s) for normal use

Was only useful to reduce pool switching problems but
some pools require a longer value.
2upstream
Tanguy Pruvot 9 years ago
parent
commit
736f916da3
  1. 2
      README.txt
  2. 5
      ccminer.cpp
  3. 2
      pools.conf
  4. 9
      util.cpp

2
README.txt

@ -120,7 +120,7 @@ its command line interface and options.
(default: retry indefinitely) (default: retry indefinitely)
-R, --retry-pause=N time to pause between retries, in seconds (default: 15) -R, --retry-pause=N time to pause between retries, in seconds (default: 15)
--time-limit maximum time [s] to mine before exiting the program. --time-limit maximum time [s] to mine before exiting the program.
-T, --timeout=N network timeout, in seconds (default: 270) -T, --timeout=N network timeout, in seconds (default: 300)
-s, --scantime=N upper bound on time spent scanning current work when -s, --scantime=N upper bound on time spent scanning current work when
long polling is unavailable, in seconds (default: 5) long polling is unavailable, in seconds (default: 5)
-n, --ndevs list cuda devices -n, --ndevs list cuda devices

5
ccminer.cpp

@ -184,7 +184,7 @@ static int opt_retries = -1;
static int opt_fail_pause = 30; static int opt_fail_pause = 30;
int opt_time_limit = -1; int opt_time_limit = -1;
time_t firstwork_time = 0; time_t firstwork_time = 0;
int opt_timeout = 60; // curl int opt_timeout = 300; // curl
int opt_scantime = 10; int opt_scantime = 10;
static json_t *opt_config; static json_t *opt_config;
static const bool opt_time = true; static const bool opt_time = true;
@ -335,7 +335,7 @@ Options:\n\
(default: retry indefinitely)\n\ (default: retry indefinitely)\n\
-R, --retry-pause=N time to pause between retries, in seconds (default: 30)\n\ -R, --retry-pause=N time to pause between retries, in seconds (default: 30)\n\
--time-limit maximum time [s] to mine before exiting the program.\n\ --time-limit maximum time [s] to mine before exiting the program.\n\
-T, --timeout=N network timeout, in seconds (default: 60)\n\ -T, --timeout=N network timeout, in seconds (default: 300)\n\
-s, --scantime=N upper bound on time spent scanning current work when\n\ -s, --scantime=N upper bound on time spent scanning current work when\n\
long polling is unavailable, in seconds (default: 10)\n\ long polling is unavailable, in seconds (default: 10)\n\
-n, --ndevs list cuda devices\n\ -n, --ndevs list cuda devices\n\
@ -2642,6 +2642,7 @@ void parse_arg(int key, char *arg)
// change some defaults if multi pools // change some defaults if multi pools
if (opt_retries == -1) opt_retries = 1; if (opt_retries == -1) opt_retries = 1;
if (opt_fail_pause == 30) opt_fail_pause = 5; if (opt_fail_pause == 30) opt_fail_pause = 5;
if (opt_timeout == 300) opt_timeout = 60;
} }
p = strstr(arg, "://"); p = strstr(arg, "://");
if (p) { if (p) {

2
pools.conf

@ -21,6 +21,8 @@
"algo" : "zr5", "algo" : "zr5",
"timeout": 60,
"api-bind" : "0.0.0.0", "api-bind" : "0.0.0.0",
"api-remote" : true, "api-remote" : true,

9
util.cpp

@ -404,7 +404,7 @@ static json_t *json_rpc_call(CURL *curl, const char *url,
char *httpdata; char *httpdata;
char len_hdr[64], hashrate_hdr[64]; char len_hdr[64], hashrate_hdr[64];
char curl_err_str[CURL_ERROR_SIZE] = { 0 }; char curl_err_str[CURL_ERROR_SIZE] = { 0 };
long timeout = longpoll ? opt_timeout*2 : opt_timeout; long timeout = longpoll ? opt_timeout : opt_timeout/2;
struct header_info hi = { 0 }; struct header_info hi = { 0 };
bool lp_scanning = longpoll_scan && !have_longpoll; bool lp_scanning = longpoll_scan && !have_longpoll;
@ -598,7 +598,7 @@ json_t *json_rpc_longpoll(CURL *curl, char *lp_url, struct pool_infos *pool, con
strlen(pool->pass)?':':'\0', pool->pass); strlen(pool->pass)?':':'\0', pool->pass);
// on pool rotate by time-limit, this keepalive can be a problem // on pool rotate by time-limit, this keepalive can be a problem
bool keepalive = pool->time_limit == 0 || pool->time_limit > opt_timeout*4; bool keepalive = pool->time_limit == 0 || pool->time_limit > opt_timeout;
return json_rpc_call(curl, lp_url, userpass, req, false, true, keepalive, curl_err); return json_rpc_call(curl, lp_url, userpass, req, false, true, keepalive, curl_err);
} }
@ -853,6 +853,7 @@ char *stratum_recv_line(struct stratum_ctx *sctx)
{ {
ssize_t len, buflen; ssize_t len, buflen;
char *tok, *sret = NULL; char *tok, *sret = NULL;
int timeout = opt_timeout;
if (!sctx->sockbuf) if (!sctx->sockbuf)
return NULL; return NULL;
@ -860,7 +861,7 @@ char *stratum_recv_line(struct stratum_ctx *sctx)
if (!strstr(sctx->sockbuf, "\n")) { if (!strstr(sctx->sockbuf, "\n")) {
bool ret = true; bool ret = true;
time_t rstart = time(NULL); time_t rstart = time(NULL);
if (!socket_full(sctx->sock, opt_timeout)) { if (!socket_full(sctx->sock, timeout)) {
applog(LOG_ERR, "stratum_recv_line timed out"); applog(LOG_ERR, "stratum_recv_line timed out");
goto out; goto out;
} }
@ -881,7 +882,7 @@ char *stratum_recv_line(struct stratum_ctx *sctx)
} }
} else } else
stratum_buffer_append(sctx, s); stratum_buffer_append(sctx, s);
} while (time(NULL) - rstart < opt_timeout && !strstr(sctx->sockbuf, "\n")); } while (time(NULL) - rstart < timeout && !strstr(sctx->sockbuf, "\n"));
if (!ret) { if (!ret) {
applog(LOG_ERR, "stratum_recv_line failed"); applog(LOG_ERR, "stratum_recv_line failed");

Loading…
Cancel
Save