1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 12:34:27 +00:00

pools: rename 'pool->enabled' to 'pool->state'.

This commit is contained in:
Noel Maersk 2014-01-26 20:02:00 +02:00
parent 22b78e91f6
commit 048c82b9b2
3 changed files with 26 additions and 26 deletions

14
api.c
View File

@ -1783,7 +1783,7 @@ static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
if (pool->removed) if (pool->removed)
continue; continue;
switch (pool->enabled) { switch (pool->state) {
case POOL_DISABLED: case POOL_DISABLED:
status = (char *)DISABLED; status = (char *)DISABLED;
break; break;
@ -2067,7 +2067,7 @@ static void switchpool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
} }
pool = pools[id]; pool = pools[id];
pool->enabled = POOL_ENABLED; pool->state = POOL_ENABLED;
cg_runlock(&control_lock); cg_runlock(&control_lock);
switch_pools(pool); switch_pools(pool);
@ -2180,12 +2180,12 @@ static void enablepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
} }
pool = pools[id]; pool = pools[id];
if (pool->enabled == POOL_ENABLED) { if (pool->state == POOL_ENABLED) {
message(io_data, MSG_ALRENAP, id, NULL, isjson); message(io_data, MSG_ALRENAP, id, NULL, isjson);
return; return;
} }
pool->enabled = POOL_ENABLED; pool->state = POOL_ENABLED;
if (pool->prio < current_pool()->prio) if (pool->prio < current_pool()->prio)
switch_pools(pool); switch_pools(pool);
@ -2324,7 +2324,7 @@ static void disablepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, ch
} }
pool = pools[id]; pool = pools[id];
if (pool->enabled == POOL_DISABLED) { if (pool->state == POOL_DISABLED) {
message(io_data, MSG_ALRDISP, id, NULL, isjson); message(io_data, MSG_ALRDISP, id, NULL, isjson);
return; return;
} }
@ -2334,7 +2334,7 @@ static void disablepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, ch
return; return;
} }
pool->enabled = POOL_DISABLED; pool->state = POOL_DISABLED;
if (pool == current_pool()) if (pool == current_pool())
switch_pools(NULL); switch_pools(NULL);
@ -2378,7 +2378,7 @@ static void removepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
return; return;
} }
pool->enabled = POOL_DISABLED; pool->state = POOL_DISABLED;
rpc_url = escape_string(pool->rpc_url, isjson); rpc_url = escape_string(pool->rpc_url, isjson);
if (rpc_url != pool->rpc_url) if (rpc_url != pool->rpc_url)
dofree = true; dofree = true;

View File

@ -1135,7 +1135,7 @@ struct curl_ent {
/* Disabled needs to be the lowest enum as a freshly calloced value will then /* Disabled needs to be the lowest enum as a freshly calloced value will then
* equal disabled */ * equal disabled */
enum pool_enable { enum pool_state {
POOL_DISABLED, POOL_DISABLED,
POOL_ENABLED, POOL_ENABLED,
POOL_REJECTING, POOL_REJECTING,
@ -1183,7 +1183,7 @@ struct pool {
bool lagging; bool lagging;
bool probed; bool probed;
bool start_disabled; bool start_disabled;
enum pool_enable enabled; enum pool_state state;
bool submit_old; bool submit_old;
bool remove_at_start; bool remove_at_start;
bool removed; bool removed;
@ -1261,7 +1261,7 @@ struct pool {
struct thread_q *stratum_q; struct thread_q *stratum_q;
int sshares; /* stratum shares submitted waiting on response */ int sshares; /* stratum shares submitted waiting on response */
/* GBT variables */ /* GBT variables */
bool has_gbt; bool has_gbt;
cglock_t gbt_lock; cglock_t gbt_lock;
unsigned char previousblockhash[32]; unsigned char previousblockhash[32];

View File

@ -2349,26 +2349,26 @@ void logwin_update(void)
static void enable_pool(struct pool *pool) static void enable_pool(struct pool *pool)
{ {
if (pool->enabled != POOL_ENABLED) { if (pool->state != POOL_ENABLED) {
enabled_pools++; enabled_pools++;
pool->enabled = POOL_ENABLED; pool->state = POOL_ENABLED;
} }
} }
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
static void disable_pool(struct pool *pool) static void disable_pool(struct pool *pool)
{ {
if (pool->enabled == POOL_ENABLED) if (pool->state == POOL_ENABLED)
enabled_pools--; enabled_pools--;
pool->enabled = POOL_DISABLED; pool->state = POOL_DISABLED;
} }
#endif #endif
static void reject_pool(struct pool *pool) static void reject_pool(struct pool *pool)
{ {
if (pool->enabled == POOL_ENABLED) if (pool->state == POOL_ENABLED)
enabled_pools--; enabled_pools--;
pool->enabled = POOL_REJECTING; pool->state = POOL_REJECTING;
} }
static void restart_threads(void); static void restart_threads(void);
@ -2421,7 +2421,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
* continually rejecting shares has started accepting shares. * continually rejecting shares has started accepting shares.
* This will only happen with the work returned from a * This will only happen with the work returned from a
* longpoll */ * longpoll */
if (unlikely(pool->enabled == POOL_REJECTING)) { if (unlikely(pool->state == POOL_REJECTING)) {
applog(LOG_WARNING, "Rejecting %s now accepting shares, re-enabling!", pool->poolname); applog(LOG_WARNING, "Rejecting %s now accepting shares, re-enabling!", pool->poolname);
enable_pool(pool); enable_pool(pool);
switch_pools(NULL); switch_pools(NULL);
@ -2774,7 +2774,7 @@ static bool pool_unworkable(struct pool *pool)
{ {
if (pool->idle) if (pool->idle)
return true; return true;
if (pool->enabled != POOL_ENABLED) if (pool->state != POOL_ENABLED)
return true; return true;
if (pool->has_stratum && !pool->stratum_active) if (pool->has_stratum && !pool->stratum_active)
return true; return true;
@ -3601,7 +3601,7 @@ static bool pool_unusable(struct pool *pool)
{ {
if (pool->idle) if (pool->idle)
return true; return true;
if (pool->enabled != POOL_ENABLED) if (pool->state != POOL_ENABLED)
return true; return true;
return false; return false;
} }
@ -4477,10 +4477,10 @@ updated:
if (pool == current_pool()) if (pool == current_pool())
wattron(logwin, A_BOLD); wattron(logwin, A_BOLD);
if (pool->enabled != POOL_ENABLED) if (pool->state != POOL_ENABLED)
wattron(logwin, A_DIM); wattron(logwin, A_DIM);
wlogprint("%d: ", pool->pool_no); wlogprint("%d: ", pool->pool_no);
switch (pool->enabled) { switch (pool->state) {
case POOL_ENABLED: case POOL_ENABLED:
wlogprint("Enabled "); wlogprint("Enabled ");
break; break;
@ -5174,7 +5174,7 @@ static bool cnx_needed(struct pool *pool)
{ {
struct pool *cp; struct pool *cp;
if (pool->enabled != POOL_ENABLED) if (pool->state != POOL_ENABLED)
return false; return false;
/* Balance strategies need all pools online */ /* Balance strategies need all pools online */
@ -6596,7 +6596,7 @@ static void convert_to_work(json_t *val, int rolltime, struct pool *pool, struct
copy_time(&work->tv_getwork_reply, tv_lp_reply); copy_time(&work->tv_getwork_reply, tv_lp_reply);
calc_diff(work, 0); calc_diff(work, 0);
if (pool->enabled == POOL_REJECTING) if (pool->state == POOL_REJECTING)
work->mandatory = true; work->mandatory = true;
if (pool->has_gbt) if (pool->has_gbt)
@ -6614,7 +6614,7 @@ static void convert_to_work(json_t *val, int rolltime, struct pool *pool, struct
* the longpoll work from a pool that has been rejecting shares as a * the longpoll work from a pool that has been rejecting shares as a
* way to detect when the pool has recovered. * way to detect when the pool has recovered.
*/ */
if (pool != current_pool() && opt_fail_only && pool->enabled != POOL_REJECTING) { if (pool != current_pool() && opt_fail_only && pool->state != POOL_REJECTING) {
free_work(work); free_work(work);
return; return;
} }
@ -6651,7 +6651,7 @@ static struct pool *select_longpoll_pool(struct pool *cp)
*/ */
static void wait_lpcurrent(struct pool *pool) static void wait_lpcurrent(struct pool *pool)
{ {
while (!cnx_needed(pool) && (pool->enabled == POOL_DISABLED || while (!cnx_needed(pool) && (pool->state == POOL_DISABLED ||
(pool != current_pool() && pool_strategy != POOL_LOADBALANCE && (pool != current_pool() && pool_strategy != POOL_LOADBALANCE &&
pool_strategy != POOL_BALANCE))) { pool_strategy != POOL_BALANCE))) {
mutex_lock(&lp_lock); mutex_lock(&lp_lock);
@ -6863,7 +6863,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
pool->shares = pool->utility; pool->shares = pool->utility;
} }
if (pool->enabled == POOL_DISABLED) if (pool->state == POOL_DISABLED)
continue; continue;
/* Don't start testing any pools if the test threads /* Don't start testing any pools if the test threads