Skip to content

Commit e5d38de

Browse files
committed
Set the pool idle and switch pool, if need
1 parent db10c4e commit e5d38de

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

miner.h

+1
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,7 @@ extern bool log_curses_only(int prio, const char *datetime, const char *str);
14651465
extern void clear_logwin(void);
14661466
extern void logwin_update(void);
14671467
extern bool pool_tclear(struct pool *pool, bool *var);
1468+
extern void pool_failed(struct pool *pool);
14681469
extern struct thread_q *tq_new(void);
14691470
extern void tq_free(struct thread_q *tq);
14701471
extern bool tq_push(struct thread_q *tq, void *data);

sgminer.c

+10
Original file line numberDiff line numberDiff line change
@@ -3816,6 +3816,16 @@ struct work *copy_work_noffset(struct work *base_work, int noffset)
38163816
return work;
38173817
}
38183818

3819+
void pool_failed(struct pool *pool)
3820+
{
3821+
if (!pool_tset(pool, &pool->idle)) {
3822+
cgtime(&pool->tv_idle);
3823+
if (pool == current_pool()) {
3824+
switch_pools(NULL);
3825+
}
3826+
}
3827+
}
3828+
38193829
static void pool_died(struct pool *pool)
38203830
{
38213831
if (!pool_tset(pool, &pool->idle)) {

util.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1748,8 +1748,10 @@ static bool parse_reconnect(struct pool *pool, json_t *val)
17481748
free(tmp);
17491749
mutex_unlock(&pool->stratum_lock);
17501750

1751-
if (!restart_stratum(pool))
1751+
if (!restart_stratum(pool)) {
1752+
pool_failed(pool);
17521753
return false;
1754+
}
17531755

17541756
return true;
17551757
}

0 commit comments

Comments
 (0)