diff --git a/README.txt b/README.txt index 3efa7ff..eb0104e 100644 --- a/README.txt +++ b/README.txt @@ -120,7 +120,7 @@ its command line interface and options. (default: retry indefinitely) -R, --retry-pause=N time to pause between retries, in seconds (default: 15) --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 long polling is unavailable, in seconds (default: 5) -n, --ndevs list cuda devices diff --git a/ccminer.cpp b/ccminer.cpp index e285ebf..7816faa 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -184,7 +184,7 @@ static int opt_retries = -1; static int opt_fail_pause = 30; int opt_time_limit = -1; time_t firstwork_time = 0; -int opt_timeout = 60; // curl +int opt_timeout = 300; // curl int opt_scantime = 10; static json_t *opt_config; static const bool opt_time = true; @@ -335,7 +335,7 @@ Options:\n\ (default: retry indefinitely)\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\ - -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\ long polling is unavailable, in seconds (default: 10)\n\ -n, --ndevs list cuda devices\n\ @@ -2642,6 +2642,7 @@ void parse_arg(int key, char *arg) // change some defaults if multi pools if (opt_retries == -1) opt_retries = 1; if (opt_fail_pause == 30) opt_fail_pause = 5; + if (opt_timeout == 300) opt_timeout = 60; } p = strstr(arg, "://"); if (p) { diff --git a/pools.conf b/pools.conf index 3d781c5..b13b801 100644 --- a/pools.conf +++ b/pools.conf @@ -21,6 +21,8 @@ "algo" : "zr5", + "timeout": 60, + "api-bind" : "0.0.0.0", "api-remote" : true, diff --git a/util.cpp b/util.cpp index 8abdcee..8efec8c 100644 --- a/util.cpp +++ b/util.cpp @@ -404,7 +404,7 @@ static json_t *json_rpc_call(CURL *curl, const char *url, char *httpdata; char len_hdr[64], hashrate_hdr[64]; 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 }; 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); // 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); } @@ -853,6 +853,7 @@ char *stratum_recv_line(struct stratum_ctx *sctx) { ssize_t len, buflen; char *tok, *sret = NULL; + int timeout = opt_timeout; if (!sctx->sockbuf) return NULL; @@ -860,7 +861,7 @@ char *stratum_recv_line(struct stratum_ctx *sctx) if (!strstr(sctx->sockbuf, "\n")) { bool ret = true; 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"); goto out; } @@ -881,7 +882,7 @@ char *stratum_recv_line(struct stratum_ctx *sctx) } } else 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) { applog(LOG_ERR, "stratum_recv_line failed");