Browse Source

Break out of searching for a proxy if the best has headroom

master
Con Kolivas 10 years ago
parent
commit
d6f0cfb210
  1. 3
      src/stratifier.c

3
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) { HASH_ITER(hh, ckp_sdata->proxies, proxy, tmp) {
int most_headroom; int most_headroom;
best = NULL;
proxy->headroom = most_headroom = 0; proxy->headroom = most_headroom = 0;
HASH_ITER(sh, proxy->subproxies, subproxy, tmpsub) { HASH_ITER(sh, proxy->subproxies, subproxy, tmpsub) {
int64_t subproxy_headroom; 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) { if (best && best->id < best_id) {
best_id = best->id; best_id = best->id;
best_subid = best->subid; best_subid = best->subid;
if (best == current)
break;
} }
} }
mutex_unlock(&ckp_sdata->proxy_lock); mutex_unlock(&ckp_sdata->proxy_lock);

Loading…
Cancel
Save