From d6f0cfb210d4a2e2bd337c3c45b9a1af320aac1e Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 17 Feb 2015 17:26:02 +1100 Subject: [PATCH] Break out of searching for a proxy if the best has headroom --- src/stratifier.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index 37b68f4b..7deba67a 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2348,6 +2348,7 @@ static sdata_t *select_sdata(const ckpool_t *ckp, sdata_t *ckp_sdata) HASH_ITER(hh, ckp_sdata->proxies, proxy, tmp) { int most_headroom; + best = NULL; proxy->headroom = most_headroom = 0; HASH_ITER(sh, proxy->subproxies, subproxy, tmpsub) { int64_t subproxy_headroom; @@ -2365,6 +2366,8 @@ static sdata_t *select_sdata(const ckpool_t *ckp, sdata_t *ckp_sdata) if (best && best->id < best_id) { best_id = best->id; best_subid = best->subid; + if (best == current) + break; } } mutex_unlock(&ckp_sdata->proxy_lock);