Skip to content

Commit

Permalink
Set the pool idle and switch pool, if need
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbandi authored and mrbrdo committed May 7, 2014
1 parent c469ff9 commit 9867676
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,7 @@ extern bool log_curses_only(int prio, const char *datetime, const char *str);
extern void clear_logwin(void);
extern void logwin_update(void);
extern bool pool_tclear(struct pool *pool, bool *var);
extern void pool_failed(struct pool *pool);
extern struct thread_q *tq_new(void);
extern void tq_free(struct thread_q *tq);
extern bool tq_push(struct thread_q *tq, void *data);
Expand Down
10 changes: 10 additions & 0 deletions sgminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3605,6 +3605,16 @@ struct work *copy_work_noffset(struct work *base_work, int noffset)
return work;
}

void pool_failed(struct pool *pool)
{
if (!pool_tset(pool, &pool->idle)) {
cgtime(&pool->tv_idle);
if (pool == current_pool()) {
switch_pools(NULL);
}
}
}

static void pool_died(struct pool *pool)
{
if (!pool_tset(pool, &pool->idle)) {
Expand Down
4 changes: 3 additions & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,8 +1712,10 @@ static bool parse_reconnect(struct pool *pool, json_t *val)
free(tmp);
mutex_unlock(&pool->stratum_lock);

if (!restart_stratum(pool))
if (!restart_stratum(pool)) {
pool_failed(pool);
return false;
}

return true;
}
Expand Down

0 comments on commit 9867676

Please sign in to comment.