Browse Source

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

nfactor-troky
Noel Maersk 11 years ago
parent
commit
048c82b9b2
  1. 14
      api.c
  2. 6
      miner.h
  3. 32
      sgminer.c

14
api.c

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

6
miner.h

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

32
sgminer.c

@ -2349,26 +2349,26 @@ void logwin_update(void) @@ -2349,26 +2349,26 @@ void logwin_update(void)
static void enable_pool(struct pool *pool)
{
if (pool->enabled != POOL_ENABLED) {
if (pool->state != POOL_ENABLED) {
enabled_pools++;
pool->enabled = POOL_ENABLED;
pool->state = POOL_ENABLED;
}
}
#ifdef HAVE_CURSES
static void disable_pool(struct pool *pool)
{
if (pool->enabled == POOL_ENABLED)
if (pool->state == POOL_ENABLED)
enabled_pools--;
pool->enabled = POOL_DISABLED;
pool->state = POOL_DISABLED;
}
#endif
static void reject_pool(struct pool *pool)
{
if (pool->enabled == POOL_ENABLED)
if (pool->state == POOL_ENABLED)
enabled_pools--;
pool->enabled = POOL_REJECTING;
pool->state = POOL_REJECTING;
}
static void restart_threads(void);
@ -2421,7 +2421,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work, @@ -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.
* This will only happen with the work returned from a
* 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);
enable_pool(pool);
switch_pools(NULL);
@ -2774,7 +2774,7 @@ static bool pool_unworkable(struct pool *pool) @@ -2774,7 +2774,7 @@ static bool pool_unworkable(struct pool *pool)
{
if (pool->idle)
return true;
if (pool->enabled != POOL_ENABLED)
if (pool->state != POOL_ENABLED)
return true;
if (pool->has_stratum && !pool->stratum_active)
return true;
@ -3601,7 +3601,7 @@ static bool pool_unusable(struct pool *pool) @@ -3601,7 +3601,7 @@ static bool pool_unusable(struct pool *pool)
{
if (pool->idle)
return true;
if (pool->enabled != POOL_ENABLED)
if (pool->state != POOL_ENABLED)
return true;
return false;
}
@ -4477,10 +4477,10 @@ updated: @@ -4477,10 +4477,10 @@ updated:
if (pool == current_pool())
wattron(logwin, A_BOLD);
if (pool->enabled != POOL_ENABLED)
if (pool->state != POOL_ENABLED)
wattron(logwin, A_DIM);
wlogprint("%d: ", pool->pool_no);
switch (pool->enabled) {
switch (pool->state) {
case POOL_ENABLED:
wlogprint("Enabled ");
break;
@ -5174,7 +5174,7 @@ static bool cnx_needed(struct pool *pool) @@ -5174,7 +5174,7 @@ static bool cnx_needed(struct pool *pool)
{
struct pool *cp;
if (pool->enabled != POOL_ENABLED)
if (pool->state != POOL_ENABLED)
return false;
/* Balance strategies need all pools online */
@ -6596,7 +6596,7 @@ static void convert_to_work(json_t *val, int rolltime, struct pool *pool, struct @@ -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);
calc_diff(work, 0);
if (pool->enabled == POOL_REJECTING)
if (pool->state == POOL_REJECTING)
work->mandatory = true;
if (pool->has_gbt)
@ -6614,7 +6614,7 @@ static void convert_to_work(json_t *val, int rolltime, struct pool *pool, struct @@ -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
* 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);
return;
}
@ -6651,7 +6651,7 @@ static struct pool *select_longpoll_pool(struct pool *cp) @@ -6651,7 +6651,7 @@ static struct pool *select_longpoll_pool(struct pool *cp)
*/
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_strategy != POOL_BALANCE))) {
mutex_lock(&lp_lock);
@ -6863,7 +6863,7 @@ static void *watchpool_thread(void __maybe_unused *userdata) @@ -6863,7 +6863,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
pool->shares = pool->utility;
}
if (pool->enabled == POOL_DISABLED)
if (pool->state == POOL_DISABLED)
continue;
/* Don't start testing any pools if the test threads

Loading…
Cancel
Save