mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-09 20:52:08 +00:00
Deprecate the opt_retries feature as no one wants cgminer to automatically abort. Leave a null placeholder for configurations that still have it.
This commit is contained in:
parent
527df8bcd3
commit
1f295cd7fa
50
cgminer.c
50
cgminer.c
@ -92,7 +92,6 @@ bool opt_quiet;
|
|||||||
static bool opt_realquiet;
|
static bool opt_realquiet;
|
||||||
bool opt_loginput;
|
bool opt_loginput;
|
||||||
const int opt_cutofftemp = 95;
|
const int opt_cutofftemp = 95;
|
||||||
static int opt_retries = -1;
|
|
||||||
static int opt_fail_pause = 5;
|
static int opt_fail_pause = 5;
|
||||||
static int fail_pause = 5;
|
static int fail_pause = 5;
|
||||||
int opt_log_interval = 5;
|
int opt_log_interval = 5;
|
||||||
@ -732,6 +731,11 @@ static char *set_icarus_timing(const char *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char *set_null(const char __maybe_unused *arg)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* These options are available from config file or commandline */
|
/* These options are available from config file or commandline */
|
||||||
static struct opt_table opt_config_table[] = {
|
static struct opt_table opt_config_table[] = {
|
||||||
#ifdef WANT_CPUMINE
|
#ifdef WANT_CPUMINE
|
||||||
@ -955,8 +959,8 @@ static struct opt_table opt_config_table[] = {
|
|||||||
opt_set_bool, &opt_removedisabled,
|
opt_set_bool, &opt_removedisabled,
|
||||||
"Remove disabled devices entirely, as if they didn't exist"),
|
"Remove disabled devices entirely, as if they didn't exist"),
|
||||||
OPT_WITH_ARG("--retries|-r",
|
OPT_WITH_ARG("--retries|-r",
|
||||||
opt_set_intval, opt_show_intval, &opt_retries,
|
set_null, NULL, NULL,
|
||||||
"Number of times to retry before giving up, if JSON-RPC call fails (-1 means never)"),
|
opt_hidden),
|
||||||
OPT_WITH_ARG("--retry-pause|-R",
|
OPT_WITH_ARG("--retry-pause|-R",
|
||||||
set_int_0_to_9999, opt_show_intval, &opt_fail_pause,
|
set_int_0_to_9999, opt_show_intval, &opt_fail_pause,
|
||||||
"Number of seconds to pause, between retries"),
|
"Number of seconds to pause, between retries"),
|
||||||
@ -2386,7 +2390,6 @@ static void *get_work_thread(void *userdata)
|
|||||||
struct pool *pool = current_pool();
|
struct pool *pool = current_pool();
|
||||||
struct curl_ent *ce = NULL;
|
struct curl_ent *ce = NULL;
|
||||||
struct work *ret_work;
|
struct work *ret_work;
|
||||||
int failures = 0;
|
|
||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
@ -2424,13 +2427,6 @@ static void *get_work_thread(void *userdata)
|
|||||||
|
|
||||||
/* obtain new work from bitcoin via JSON-RPC */
|
/* obtain new work from bitcoin via JSON-RPC */
|
||||||
while (!get_upstream_work(ret_work, ce->curl)) {
|
while (!get_upstream_work(ret_work, ce->curl)) {
|
||||||
if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) {
|
|
||||||
applog(LOG_ERR, "json_rpc_call failed, terminating workio thread");
|
|
||||||
free_work(ret_work);
|
|
||||||
kill_work();
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pause, then restart work-request loop */
|
/* pause, then restart work-request loop */
|
||||||
applog(LOG_DEBUG, "json_rpc_call failed on get work, retry after %d seconds",
|
applog(LOG_DEBUG, "json_rpc_call failed on get work, retry after %d seconds",
|
||||||
fail_pause);
|
fail_pause);
|
||||||
@ -2535,7 +2531,6 @@ static void *submit_work_thread(void *userdata)
|
|||||||
struct work *work = wc->work;
|
struct work *work = wc->work;
|
||||||
struct pool *pool = work->pool;
|
struct pool *pool = work->pool;
|
||||||
struct curl_ent *ce;
|
struct curl_ent *ce;
|
||||||
int failures = 0;
|
|
||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
@ -2567,11 +2562,6 @@ static void *submit_work_thread(void *userdata)
|
|||||||
pool->stale_shares++;
|
pool->stale_shares++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) {
|
|
||||||
applog(LOG_ERR, "Failed %d retries ...terminating workio thread", opt_retries);
|
|
||||||
kill_work();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pause, then restart work-request loop */
|
/* pause, then restart work-request loop */
|
||||||
applog(LOG_INFO, "json_rpc_call failed on submit_work, retry after %d seconds",
|
applog(LOG_INFO, "json_rpc_call failed on submit_work, retry after %d seconds",
|
||||||
@ -3507,9 +3497,9 @@ static void set_options(void)
|
|||||||
immedok(logwin, true);
|
immedok(logwin, true);
|
||||||
clear_logwin();
|
clear_logwin();
|
||||||
retry:
|
retry:
|
||||||
wlogprint("[Q]ueue: %d\n[S]cantime: %d\n[E]xpiry: %d\n[R]etries: %d\n"
|
wlogprint("[Q]ueue: %d\n[S]cantime: %d\n[E]xpiry: %d\n"
|
||||||
"[P]ause: %d\n[W]rite config file\n[C]gminer restart\n",
|
"[P]ause: %d\n[W]rite config file\n[C]gminer restart\n",
|
||||||
opt_queue, opt_scantime, opt_expiry, opt_retries, opt_fail_pause);
|
opt_queue, opt_scantime, opt_expiry, opt_fail_pause);
|
||||||
wlogprint("Select an option or any other key to return\n");
|
wlogprint("Select an option or any other key to return\n");
|
||||||
input = getch();
|
input = getch();
|
||||||
|
|
||||||
@ -3537,14 +3527,6 @@ retry:
|
|||||||
}
|
}
|
||||||
opt_expiry = selected;
|
opt_expiry = selected;
|
||||||
goto retry;
|
goto retry;
|
||||||
} else if (!strncasecmp(&input, "r", 1)) {
|
|
||||||
selected = curses_int("Retries before failing (-1 infinite)");
|
|
||||||
if (selected < -1 || selected > 9999) {
|
|
||||||
wlogprint("Invalid selection\n");
|
|
||||||
goto retry;
|
|
||||||
}
|
|
||||||
opt_retries = selected;
|
|
||||||
goto retry;
|
|
||||||
} else if (!strncasecmp(&input, "p", 1)) {
|
} else if (!strncasecmp(&input, "p", 1)) {
|
||||||
selected = curses_int("Seconds to pause before network retries");
|
selected = curses_int("Seconds to pause before network retries");
|
||||||
if (selected < 1 || selected > 9999) {
|
if (selected < 1 || selected > 9999) {
|
||||||
@ -4033,7 +4015,6 @@ static bool get_work(struct work *work, struct thr_info *thr, const int thr_id)
|
|||||||
struct work *work_heap;
|
struct work *work_heap;
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
struct pool *pool;
|
struct pool *pool;
|
||||||
int failures = 0;
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
/* Tell the watchdog thread this thread is waiting on getwork and
|
/* Tell the watchdog thread this thread is waiting on getwork and
|
||||||
@ -4109,10 +4090,6 @@ retry:
|
|||||||
ret = true;
|
ret = true;
|
||||||
out:
|
out:
|
||||||
if (unlikely(ret == false)) {
|
if (unlikely(ret == false)) {
|
||||||
if ((opt_retries >= 0) && (++failures > opt_retries)) {
|
|
||||||
applog(LOG_ERR, "Failed %d times to get_work");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
applog(LOG_DEBUG, "Retrying after %d seconds", fail_pause);
|
applog(LOG_DEBUG, "Retrying after %d seconds", fail_pause);
|
||||||
sleep(fail_pause);
|
sleep(fail_pause);
|
||||||
fail_pause += opt_fail_pause;
|
fail_pause += opt_fail_pause;
|
||||||
@ -4570,16 +4547,9 @@ retry_pool:
|
|||||||
gettimeofday(&end, NULL);
|
gettimeofday(&end, NULL);
|
||||||
if (end.tv_sec - start.tv_sec > 30)
|
if (end.tv_sec - start.tv_sec > 30)
|
||||||
continue;
|
continue;
|
||||||
if (opt_retries == -1 || failures++ < opt_retries) {
|
|
||||||
if (failures == 1)
|
if (failures == 1)
|
||||||
applog(LOG_WARNING,
|
applog(LOG_WARNING, "longpoll failed for %s, retrying every 30s", pool->lp_url);
|
||||||
"longpoll failed for %s, retrying every 30s", pool->lp_url);
|
|
||||||
sleep(30);
|
sleep(30);
|
||||||
} else {
|
|
||||||
applog(LOG_ERR,
|
|
||||||
"longpoll failed for %s, ending thread", pool->lp_url);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (pool != cp) {
|
if (pool != cp) {
|
||||||
pool = select_longpoll_pool(cp);
|
pool = select_longpoll_pool(cp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user