Browse Source

Add a bool for explicit enabling/disabling of pools.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
7841486f83
  1. 20
      main.c
  2. 1
      miner.h

20
main.c

@ -912,10 +912,13 @@ static int rotating_pool;
static inline struct pool *select_pool(void) static inline struct pool *select_pool(void)
{ {
if (pool_strategy == POOL_LOADBALANCE) { if (pool_strategy == POOL_LOADBALANCE) {
struct pool *pool;
rotating_pool++; rotating_pool++;
if (rotating_pool >= total_pools) if (rotating_pool >= total_pools)
rotating_pool = 0; rotating_pool = 0;
if (!pools[rotating_pool].idle) pool = &pools[rotating_pool];
if (!pool->idle && pool->enabled)
return &pools[rotating_pool]; return &pools[rotating_pool];
} }
return current_pool(); return current_pool();
@ -1207,7 +1210,7 @@ static void switch_pools(void)
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
pool = &pools[i]; pool = &pools[i];
if (!pool->idle) if (!pool->idle && pool->enabled)
pools_active++; pools_active++;
} }
@ -1223,7 +1226,7 @@ static void switch_pools(void)
case POOL_FAILOVER: case POOL_FAILOVER:
case POOL_LOADBALANCE: case POOL_LOADBALANCE:
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
if (!pools[i].idle) { if (!pools[i].idle && pools[i].enabled) {
pool_no = i; pool_no = i;
break; break;
} }
@ -1339,7 +1342,8 @@ static void display_pools(void)
if (i == cp) if (i == cp)
wattron(logwin, A_BOLD); wattron(logwin, A_BOLD);
wprintw(logwin, "Pool %d: %s User:%s\n", pool->pool_no, pool->rpc_url, pool->rpc_user); wprintw(logwin, "%s Pool %d: %s User:%s\n", pool->enabled? "Enabled" : "Disabled",
pool->pool_no, pool->rpc_url, pool->rpc_user);
wattroff(logwin, A_BOLD); wattroff(logwin, A_BOLD);
} }
//wprintw(logwin, "[A]dd pool [S]witch pool [D]isable pool [E]nable pool"); //wprintw(logwin, "[A]dd pool [S]witch pool [D]isable pool [E]nable pool");
@ -2512,6 +2516,9 @@ static void *watchdog_thread(void *userdata)
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
struct pool *pool = &pools[i]; struct pool *pool = &pools[i];
if (!pool->enabled)
continue;
/* Test pool is idle once every minute */ /* Test pool is idle once every minute */
if (pool->idle && now.tv_sec - pool->tv_idle.tv_sec > 60) { if (pool->idle && now.tv_sec - pool->tv_idle.tv_sec > 60) {
gettimeofday(&pool->tv_idle, NULL); gettimeofday(&pool->tv_idle, NULL);
@ -2902,10 +2909,9 @@ int main (int argc, char *argv[])
if (pool_active(pool)) { if (pool_active(pool)) {
applog(LOG_INFO, "Pool %d %s active", pool->pool_no, pool->rpc_url); applog(LOG_INFO, "Pool %d %s active", pool->pool_no, pool->rpc_url);
pools_active++; pools_active++;
} else { pool->enabled = true;
} else
applog(LOG_WARNING, "Unable to get work from pool %d %s", pool->pool_no, pool->rpc_url); applog(LOG_WARNING, "Unable to get work from pool %d %s", pool->pool_no, pool->rpc_url);
pool->idle = true;
}
} }
if (!pools_active) if (!pools_active)

1
miner.h

@ -272,6 +272,7 @@ struct pool {
bool idle; bool idle;
bool has_rolltime; bool has_rolltime;
bool probed; bool probed;
bool enabled;
unsigned int getwork_requested; unsigned int getwork_requested;
unsigned int stale_shares; unsigned int stale_shares;
unsigned int discarded_work; unsigned int discarded_work;

Loading…
Cancel
Save