Skip to content
Permalink
Browse files

Restore default timeout (300s) for normal use

Was only useful to reduce pool switching problems but
some pools require a longer value.
  • Loading branch information...
tpruvot committed Aug 22, 2015
1 parent c9ef0b6 commit 736f916da3ff6d8c8e1c07021f015e686f7ad60f
Showing with 11 additions and 7 deletions.
  1. +1 −1 README.txt
  2. +3 −2 ccminer.cpp
  3. +2 −0 pools.conf
  4. +5 −4 util.cpp
@@ -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
@@ -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) {
@@ -21,6 +21,8 @@

"algo" : "zr5",

"timeout": 60,

"api-bind" : "0.0.0.0",
"api-remote" : true,

@@ -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,14 +853,15 @@ 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;

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");

0 comments on commit 736f916

Please sign in to comment.
You can’t perform that action at this time.