mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Start mining as soon as any pool is found active and rely on the watchpool thread to bring up other pools.
This commit is contained in:
parent
82798f6f98
commit
8e682a2c32
24
cgminer.c
24
cgminer.c
@ -4056,12 +4056,12 @@ void enable_device(struct cgpu_info *cgpu)
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
unsigned int i, pools_active = 0;
|
||||
unsigned int j, k;
|
||||
struct block *block, *tmpblock;
|
||||
struct work *work, *tmpwork;
|
||||
bool pools_active = false;
|
||||
struct sigaction handler;
|
||||
struct thr_info *thr;
|
||||
unsigned int i, j, k;
|
||||
|
||||
/* This dangerous functions tramples random dynamically allocated
|
||||
* variables so do it before anything at all */
|
||||
@ -4318,24 +4318,28 @@ int main (int argc, char *argv[])
|
||||
/* We use the getq mutex as the staged lock */
|
||||
stgd_lock = &getq->mutex;
|
||||
|
||||
retry_pools:
|
||||
/* Test each pool to see if we can retrieve and use work and for what
|
||||
* it supports */
|
||||
for (i = 0; i < total_pools; i++) {
|
||||
struct pool *pool;
|
||||
struct pool *pool = pools[i];
|
||||
|
||||
pool = pools[i];
|
||||
pool->enabled = true;
|
||||
pool->idle = true;
|
||||
}
|
||||
|
||||
applog(LOG_NOTICE, "Probing for an alive pool");
|
||||
do {
|
||||
/* Look for at least one active pool before starting */
|
||||
for (i = 0; i < total_pools; i++) {
|
||||
struct pool *pool = pools[i];
|
||||
if (pool_active(pool, false)) {
|
||||
if (!currentpool)
|
||||
currentpool = pool;
|
||||
applog(LOG_INFO, "Pool %d %s active", pool->pool_no, pool->rpc_url);
|
||||
pools_active++;
|
||||
pools_active = true;
|
||||
break;
|
||||
} else {
|
||||
if (pool == currentpool)
|
||||
currentpool = NULL;
|
||||
applog(LOG_WARNING, "Unable to get work from pool %d %s", pool->pool_no, pool->rpc_url);
|
||||
pool->idle = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4360,8 +4364,8 @@ retry_pools:
|
||||
nocbreak();
|
||||
} else
|
||||
quit(0, "No servers could be used! Exiting.");
|
||||
goto retry_pools;
|
||||
}
|
||||
} while (!pools_active);
|
||||
|
||||
if (want_longpoll)
|
||||
start_longpoll();
|
||||
|
Loading…
Reference in New Issue
Block a user