mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-13 14:42:05 +00:00
Abstract out active pools count.
This commit is contained in:
parent
31a8944564
commit
cca6f49ef8
24
main.c
24
main.c
@ -1398,11 +1398,22 @@ static int curses_int(const char *query)
|
|||||||
|
|
||||||
static bool input_pool(bool live);
|
static bool input_pool(bool live);
|
||||||
|
|
||||||
|
static int active_pools(void)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < total_pools; i++) {
|
||||||
|
if ((pools[i])->enabled)
|
||||||
|
ret++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void display_pools(void)
|
static void display_pools(void)
|
||||||
{
|
{
|
||||||
int i, active = 0;
|
|
||||||
struct pool *pool;
|
struct pool *pool;
|
||||||
int selected;
|
int selected, i;
|
||||||
char input;
|
char input;
|
||||||
|
|
||||||
opt_loginput = true;
|
opt_loginput = true;
|
||||||
@ -1422,7 +1433,8 @@ updated:
|
|||||||
}
|
}
|
||||||
retry:
|
retry:
|
||||||
wprintw(logwin, "\nCurrent pool management strategy: %s\n", strategies[pool_strategy]);
|
wprintw(logwin, "\nCurrent pool management strategy: %s\n", strategies[pool_strategy]);
|
||||||
wprintw(logwin, "[A]dd pool [D]isable pool [E]nable pool [S]witch pool\n");
|
wprintw(logwin, "[A]dd pool [R]emove pool [D]isable pool [E]nable pool\n");
|
||||||
|
wprintw(logwin, "[C]hange management strategy [S]witch pool\n");
|
||||||
wprintw(logwin, "Or press any other key to continue\n");
|
wprintw(logwin, "Or press any other key to continue\n");
|
||||||
wrefresh(logwin);
|
wrefresh(logwin);
|
||||||
pthread_mutex_unlock(&curses_lock);
|
pthread_mutex_unlock(&curses_lock);
|
||||||
@ -1442,11 +1454,7 @@ retry:
|
|||||||
switch_pools(pool);
|
switch_pools(pool);
|
||||||
goto updated;
|
goto updated;
|
||||||
} else if (!strncasecmp(&input, "d", 1)) {
|
} else if (!strncasecmp(&input, "d", 1)) {
|
||||||
for (i = 0; i < total_pools; i++) {
|
if (active_pools() <= 1) {
|
||||||
if ((pools[i])->enabled)
|
|
||||||
active++;
|
|
||||||
}
|
|
||||||
if (active <= 1) {
|
|
||||||
wprintw(logwin, "Cannot disable last pool");
|
wprintw(logwin, "Cannot disable last pool");
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user