mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Provide a --lowmem option which does not cache shares on failed submission to prevent low memory hardware (eg Avalon) from crashing.
This commit is contained in:
parent
c4a8f47769
commit
3f24653f56
1
README
1
README
@ -161,6 +161,7 @@ Options for both config file and command line:
|
||||
--kernel-path|-K <arg> Specify a path to where bitstream and kernel files are (default: "/usr/local/bin")
|
||||
--load-balance Change multipool strategy from failover to efficiency based balance
|
||||
--log|-l <arg> Interval in seconds between log output (default: 5)
|
||||
--lowmem Minimise caching of shares for low memory applications
|
||||
--monitor|-m <arg> Use custom pipe cmd for output messages
|
||||
--net-delay Impose small delays in networking to not overload slow routers
|
||||
--no-submit-stale Don't submit shares if they are detected as stale
|
||||
|
19
cgminer.c
19
cgminer.c
@ -125,6 +125,7 @@ static bool opt_submit_stale = true;
|
||||
static int opt_shares;
|
||||
bool opt_fail_only;
|
||||
static bool opt_fix_protocol;
|
||||
static bool opt_lowmem;
|
||||
bool opt_autofan;
|
||||
bool opt_autoengine;
|
||||
bool opt_noadl;
|
||||
@ -1019,6 +1020,9 @@ static struct opt_table opt_config_table[] = {
|
||||
OPT_WITH_ARG("--log|-l",
|
||||
set_int_0_to_9999, opt_show_intval, &opt_log_interval,
|
||||
"Interval in seconds between log output"),
|
||||
OPT_WITHOUT_ARG("--lowmem",
|
||||
opt_set_bool, &opt_lowmem,
|
||||
"Minimise caching of shares for low memory applications"),
|
||||
#if defined(unix)
|
||||
OPT_WITH_ARG("--monitor|-m",
|
||||
opt_set_charp, NULL, &opt_stderr_cmd,
|
||||
@ -2444,6 +2448,10 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
|
||||
if (!pool_tset(pool, &pool->submit_fail)) {
|
||||
total_ro++;
|
||||
pool->remotefail_occasions++;
|
||||
if (opt_lowmem) {
|
||||
applog(LOG_WARNING, "Pool %d communication failure, discarding shares", pool->pool_no);
|
||||
goto out;
|
||||
}
|
||||
applog(LOG_WARNING, "Pool %d communication failure, caching submissions", pool->pool_no);
|
||||
}
|
||||
nmsleep(5000);
|
||||
@ -3292,6 +3300,11 @@ static void *submit_work_thread(void *userdata)
|
||||
pool->remotefail_occasions++;
|
||||
}
|
||||
|
||||
if (opt_lowmem) {
|
||||
applog(LOG_DEBUG, "Lowmem option prevents resubmitting stratum share");
|
||||
break;
|
||||
}
|
||||
|
||||
cg_rlock(&pool->data_lock);
|
||||
sessionid_match = (pool->nonce1 && !strcmp(work->nonce1, pool->nonce1));
|
||||
cg_runlock(&pool->data_lock);
|
||||
@ -3317,6 +3330,10 @@ static void *submit_work_thread(void *userdata)
|
||||
ce = pop_curl_entry(pool);
|
||||
/* submit solution to bitcoin via JSON-RPC */
|
||||
while (!submit_upstream_work(work, ce->curl, resubmit)) {
|
||||
if (opt_lowmem) {
|
||||
applog(LOG_NOTICE, "Pool %d share being discarded to minimise memory cache", pool->pool_no);
|
||||
break;
|
||||
}
|
||||
resubmit = true;
|
||||
if (stale_work(work, true)) {
|
||||
applog(LOG_NOTICE, "Pool %d share became stale while retrying submit, discarding", pool->pool_no);
|
||||
@ -4939,7 +4956,7 @@ static void *stratum_thread(void *userdata)
|
||||
/* If the socket to our stratum pool disconnects, all
|
||||
* tracked submitted shares are lost and we will leak
|
||||
* the memory if we don't discard their records. */
|
||||
if (!supports_resume(pool))
|
||||
if (!supports_resume(pool) || opt_lowmem)
|
||||
clear_stratum_shares(pool);
|
||||
clear_pool_work(pool);
|
||||
if (pool == current_pool())
|
||||
|
Loading…
Reference in New Issue
Block a user