Skip to content

Commit

Permalink
Merge commit 'be37d5e' into bfgminer
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Aug 16, 2016
2 parents 3c4348d + be37d5e commit 1e93ff6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion driver-stratum.c
Expand Up @@ -139,7 +139,7 @@ bool stratumsrv_update_notify_str(struct pool * const pool)
struct work work;
work2d_gen_dummy_work_for_stale_check(&work, &pool->swork, &tv_now, NULL);

const bool is_stale = stale_work(&work, false);
const bool is_stale = stale_work2(&work, false, true);

clean_work(&work);

Expand Down
12 changes: 7 additions & 5 deletions miner.c
Expand Up @@ -6389,8 +6389,6 @@ static void push_curl_entry(struct curl_ent *ce, struct pool *pool)
mutex_unlock(&pool->pool_lock);
}

bool stale_work(struct work *work, bool share);

static inline bool should_roll(struct work *work)
{
struct timeval now;
Expand Down Expand Up @@ -6584,7 +6582,7 @@ static void pool_died(struct pool *pool)
mutex_unlock(&lp_lock);
}

bool stale_work(struct work *work, bool share)
bool stale_work2(struct work * const work, const bool share, const bool have_pool_data_lock)
{
unsigned work_expiry;
struct pool *pool;
Expand Down Expand Up @@ -6657,10 +6655,14 @@ bool stale_work(struct work *work, bool share)

same_job = true;

cg_rlock(&pool->data_lock);
if (!have_pool_data_lock) {
cg_rlock(&pool->data_lock);
}
if (strcmp(work->job_id, pool->swork.job_id))
same_job = false;
cg_runlock(&pool->data_lock);
if (!have_pool_data_lock) {
cg_runlock(&pool->data_lock);
}

if (!same_job) {
applog(LOG_DEBUG, "Work stale due to stratum job_id mismatch");
Expand Down
3 changes: 2 additions & 1 deletion miner.h
Expand Up @@ -1078,7 +1078,8 @@ extern void thread_reportin(struct thr_info *thr);
extern void thread_reportout(struct thr_info *);
extern void clear_stratum_shares(struct pool *pool);
extern void hashmeter2(struct thr_info *);
extern bool stale_work(struct work *, bool share);
extern bool stale_work2(struct work *, bool share, bool have_pool_data_lock);
#define stale_work(work, share) stale_work2(work, share, false)
extern bool stale_work_future(struct work *, bool share, unsigned long ustime);
extern void blkhashstr(char *out, const unsigned char *hash);
static const float minimum_pdiff = max(FLT_MIN, 1./0x100000000);
Expand Down

0 comments on commit 1e93ff6

Please sign in to comment.