Skip to content

Commit

Permalink
Only include block display lines for active goals
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Oct 29, 2014
1 parent c0ede2b commit 72f1312
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ static char best_share[ALLOC_H2B_SHORTV] = "0";
double best_diff = 0;

struct mining_goal_info *mining_goals;
int active_goals = 1;


int swork_id;
Expand Down Expand Up @@ -1033,7 +1034,7 @@ struct mining_goal_info *get_mining_goal(const char * const name)
HASH_SORT(mining_goals, mining_goals_name_cmp);

#ifdef HAVE_CURSES
devcursor = 7 + HASH_COUNT(mining_goals);
devcursor = 7 + active_goals;
switch_logsize();
#endif
}
Expand Down Expand Up @@ -4332,14 +4333,32 @@ void update_block_display_line(const int blky, struct mining_goal_info *goal)
wclrtoeol(statuswin);
}

static bool pool_actively_in_use(const struct pool *, const struct pool *);

static
void update_block_display(void)
{
struct mining_goal_info *goal, *tmpgoal;
int blky = 3;
int blky = 3, i, total_found_goals = 0;
HASH_ITER(hh, mining_goals, goal, tmpgoal)
{
for (i = 0; i < total_pools; ++i)
{
struct pool * const pool = pools[i];
if (pool->goal == goal && pool_actively_in_use(pool, NULL))
break;
}
if (i >= total_pools)
// no pools using this goal, so it's probably stale anyway
continue;
update_block_display_line(blky++, goal);
++total_found_goals;
}
if (total_found_goals != active_goals)
{
active_goals = total_found_goals;
devcursor = 7 + active_goals;
switch_logsize();
}
}

Expand Down Expand Up @@ -4679,6 +4698,7 @@ static void switch_logsize(void)
unlock_curses();
}
check_winsizes();
update_block_display();
}

/* For mandatory printing when mutex is already locked */
Expand Down Expand Up @@ -6891,6 +6911,9 @@ void switch_pools(struct pool *selected)
pthread_cond_broadcast(&lp_cond);
mutex_unlock(&lp_lock);

#ifdef HAVE_CURSES
update_block_display();
#endif
}

static void discard_work(struct work *work)
Expand Down

0 comments on commit 72f1312

Please sign in to comment.