|
|
@@ -202,6 +202,7 @@ int total_accepted, total_rejected, total_diff1;
|
|
|
float total_accepted_weighed;
|
|
|
int total_getworks, total_stale, total_discarded;
|
|
|
static int total_queued, staged_rollable;
|
|
|
+static int queued_getworks;
|
|
|
unsigned int new_blocks;
|
|
|
unsigned int found_blocks;
|
|
|
|
|
|
@@ -2648,6 +2649,9 @@ out:
|
|
|
workio_cmd_free(wc);
|
|
|
if (ce)
|
|
|
push_curl_entry(ce, pool);
|
|
|
+ mutex_lock(&control_lock);
|
|
|
+ queued_getworks--;
|
|
|
+ mutex_unlock(&control_lock);
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
@@ -4339,7 +4343,17 @@ static void pool_resus(struct pool *pool)
|
|
|
static bool queue_request(struct thr_info *thr, bool needed)
|
|
|
{
|
|
|
struct workio_cmd *wc;
|
|
|
+ bool doq = true;
|
|
|
|
|
|
+ mutex_lock(&control_lock);
|
|
|
+ if (queued_getworks > (mining_threads + opt_queue) * 2)
|
|
|
+ doq = false;
|
|
|
+ else
|
|
|
+ queued_getworks++;
|
|
|
+ mutex_unlock(&control_lock);
|
|
|
+ if (!doq)
|
|
|
+ return true;
|
|
|
+
|
|
|
/* fill out work request message */
|
|
|
wc = calloc(1, sizeof(*wc));
|
|
|
if (unlikely(!wc)) {
|