Browse Source

Don't pause after failed getwork, set lagging flag and reassess.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
35cb7fd101
  1. 29
      cgminer.c

29
cgminer.c

@ -2380,13 +2380,15 @@ static void *get_work_thread(void *userdata)
struct workio_cmd *wc = (struct workio_cmd *)userdata; struct workio_cmd *wc = (struct workio_cmd *)userdata;
int ts, tq, maxq = opt_queue + mining_threads; int ts, tq, maxq = opt_queue + mining_threads;
struct pool *pool = current_pool(); struct pool *pool = current_pool();
struct work *ret_work= NULL;
struct curl_ent *ce = NULL; struct curl_ent *ce = NULL;
struct work *ret_work; bool lagging = false;
pthread_detach(pthread_self()); pthread_detach(pthread_self());
applog(LOG_DEBUG, "Creating extra get work thread"); applog(LOG_DEBUG, "Creating extra get work thread");
retry:
tq = global_queued(); tq = global_queued();
ts = total_staged(); ts = total_staged();
@ -2399,30 +2401,33 @@ static void *get_work_thread(void *userdata)
if (clone_available()) if (clone_available())
goto out; goto out;
ret_work = make_work(); if (!ret_work)
ret_work = make_work();
if (wc->thr) if (wc->thr)
ret_work->thr = wc->thr; ret_work->thr = wc->thr;
else else
ret_work->thr = NULL; ret_work->thr = NULL;
if (opt_benchmark) if (opt_benchmark) {
get_benchmark_work(ret_work); get_benchmark_work(ret_work);
else { ret_work->queued = true;
bool lagging = false; } else {
if (ts <= opt_queue) if (ts <= opt_queue)
lagging = true; lagging = true;
pool = ret_work->pool = select_pool(lagging); pool = ret_work->pool = select_pool(lagging);
inc_queued(); inc_queued();
ce = pop_curl_entry(pool); if (!ce)
ce = pop_curl_entry(pool);
/* obtain new work from bitcoin via JSON-RPC */ /* obtain new work from bitcoin via JSON-RPC */
while (!get_upstream_work(ret_work, ce->curl)) { if (!get_upstream_work(ret_work, ce->curl)) {
/* pause, then restart work-request loop */ /* pause, then restart work-request loop */
applog(LOG_DEBUG, "json_rpc_call failed on get work, retry after %d seconds", applog(LOG_DEBUG, "json_rpc_call failed on get work, retrying");
opt_fail_pause); lagging = true;
sleep(opt_fail_pause); dec_queued();
goto retry;
} }
ret_work->queued = true; ret_work->queued = true;
@ -2438,6 +2443,8 @@ static void *get_work_thread(void *userdata)
} }
out: out:
if (ret_work && !ret_work->queued)
free_work(ret_work);
workio_cmd_free(wc); workio_cmd_free(wc);
if (ce) if (ce)
push_curl_entry(ce, pool); push_curl_entry(ce, pool);

Loading…
Cancel
Save