mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 12:34:27 +00:00
pools: Allow disabling pool even if it's the last one enabled.
Pool state machine is incomplete, and enabled_pools is not increased if pool state is not explicitly set to "enabled" in config. However, there is no reason why the user should not be allowed to disable all pools. enabled_pools is a bookkeeping variable, and bookkeeping is cumbersome. Rather than trying to fix this regression, get rid of another place where enabled_pools is used. Closes https://github.com/veox/sgminer/issues/75
This commit is contained in:
parent
f5c51b7771
commit
0e8ec8d060
7
api.c
7
api.c
@ -274,7 +274,6 @@ static const char *JSON_PARAMETER = "parameter";
|
||||
#define MSG_DISPOOL 48
|
||||
#define MSG_ALRENAP 49
|
||||
#define MSG_ALRDISP 50
|
||||
#define MSG_DISLASTP 51
|
||||
#define MSG_MISPDP 52
|
||||
#define MSG_INVPDP 53
|
||||
#define MSG_TOOMANYP 54
|
||||
@ -399,7 +398,6 @@ struct CODES {
|
||||
{ SEVERITY_SUCC, MSG_DISPOOL, PARAM_POOL, "Disabling pool %d:'%s'" },
|
||||
{ SEVERITY_INFO, MSG_ALRENAP, PARAM_POOL, "Pool %d:'%s' already enabled" },
|
||||
{ SEVERITY_INFO, MSG_ALRDISP, PARAM_POOL, "Pool %d:'%s' already disabled" },
|
||||
{ SEVERITY_ERR, MSG_DISLASTP,PARAM_POOL, "Cannot disable last active pool %d:'%s'" },
|
||||
{ SEVERITY_ERR, MSG_MISPDP, PARAM_NONE, "Missing addpool details" },
|
||||
{ SEVERITY_ERR, MSG_INVPDP, PARAM_STR, "Invalid addpool details '%s'" },
|
||||
{ SEVERITY_ERR, MSG_TOOMANYP,PARAM_NONE, "Reached maximum number of pools (%d)" },
|
||||
@ -2350,11 +2348,6 @@ static void disablepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, ch
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled_pools <= 1) {
|
||||
message(io_data, MSG_DISLASTP, id, NULL, isjson);
|
||||
return;
|
||||
}
|
||||
|
||||
pool->state = POOL_DISABLED;
|
||||
if (pool == current_pool())
|
||||
switch_pools(NULL);
|
||||
|
@ -4542,10 +4542,6 @@ retry:
|
||||
switch_pools(pool);
|
||||
goto updated;
|
||||
} else if (!strncasecmp(&input, "d", 1)) {
|
||||
if (enabled_pools <= 1) {
|
||||
wlogprint("Cannot disable last pool");
|
||||
goto retry;
|
||||
}
|
||||
selected = curses_int("Select pool number");
|
||||
if (selected < 0 || selected >= total_pools) {
|
||||
wlogprint("Invalid selection\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user