1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-25 14:04:25 +00:00

Logic fail on queueing multiple requests at once. Just queue one at a time.

This commit is contained in:
Con Kolivas 2012-06-25 10:51:45 +10:00
parent 42ea29ca4e
commit 17ba2dca63

View File

@ -3550,7 +3550,7 @@ static bool queue_request(struct thr_info *thr, bool needed)
struct workio_cmd *wc; struct workio_cmd *wc;
struct timeval now; struct timeval now;
time_t scan_post; time_t scan_post;
int toq, rq, rs; int rq, rs;
bool ret = true; bool ret = true;
/* Prevent multiple requests being executed at once */ /* Prevent multiple requests being executed at once */
@ -3577,42 +3577,33 @@ static bool queue_request(struct thr_info *thr, bool needed)
requested_tv_sec = now.tv_sec; requested_tv_sec = now.tv_sec;
if (rq > rs) inc_queued();
toq = rq - mining_threads;
else
toq = rs - mining_threads;
do { /* fill out work request message */
inc_queued(); wc = calloc(1, sizeof(*wc));
if (unlikely(!wc)) {
applog(LOG_ERR, "Failed to calloc wc in queue_request");
ret = false;
goto out;
}
/* fill out work request message */ wc->cmd = WC_GET_WORK;
wc = calloc(1, sizeof(*wc)); wc->thr = thr;
if (unlikely(!wc)) {
applog(LOG_ERR, "Failed to calloc wc in queue_request");
ret = false;
break;
}
wc->cmd = WC_GET_WORK; /* If we're queueing work faster than we can stage it, consider the
wc->thr = thr; * system lagging and allow work to be gathered from another pool if
* possible */
if (rq && needed && !rs && !opt_fail_only)
wc->lagging = true;
/* If we're queueing work faster than we can stage it, consider the applog(LOG_DEBUG, "Queueing getwork request to work thread");
* system lagging and allow work to be gathered from another pool if
* possible */
if (rq && needed && !rs && !opt_fail_only)
wc->lagging = true;
applog(LOG_DEBUG, "Queueing getwork request to work thread"); /* send work request to workio thread */
if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
/* send work request to workio thread */ applog(LOG_ERR, "Failed to tq_push in queue_request");
if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) { workio_cmd_free(wc);
applog(LOG_ERR, "Failed to tq_push in queue_request"); ret = false;
workio_cmd_free(wc); }
ret = false;
break;
}
} while (--toq > 0);
out: out:
control_tclear(&queueing); control_tclear(&queueing);