|
|
@ -2456,10 +2456,10 @@ static sdata_t *select_sdata(const ckpool_t *ckp, sdata_t *ckp_sdata) |
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&ckp_sdata->proxy_lock); |
|
|
|
mutex_lock(&ckp_sdata->proxy_lock); |
|
|
|
HASH_ITER(hh, ckp_sdata->proxies, proxy, tmp) { |
|
|
|
HASH_ITER(hh, ckp_sdata->proxies, proxy, tmp) { |
|
|
|
int most_headroom; |
|
|
|
int64_t max_headroom; |
|
|
|
|
|
|
|
|
|
|
|
best = NULL; |
|
|
|
best = NULL; |
|
|
|
proxy->headroom = most_headroom = 0; |
|
|
|
proxy->headroom = max_headroom = 0; |
|
|
|
HASH_ITER(sh, proxy->subproxies, subproxy, tmpsub) { |
|
|
|
HASH_ITER(sh, proxy->subproxies, subproxy, tmpsub) { |
|
|
|
int64_t subproxy_headroom; |
|
|
|
int64_t subproxy_headroom; |
|
|
|
|
|
|
|
|
|
|
@ -2470,9 +2470,9 @@ static sdata_t *select_sdata(const ckpool_t *ckp, sdata_t *ckp_sdata) |
|
|
|
subproxy_headroom = subproxy->max_clients - subproxy->clients; |
|
|
|
subproxy_headroom = subproxy->max_clients - subproxy->clients; |
|
|
|
|
|
|
|
|
|
|
|
proxy->headroom += subproxy_headroom; |
|
|
|
proxy->headroom += subproxy_headroom; |
|
|
|
if (subproxy_headroom > most_headroom) { |
|
|
|
if (subproxy_headroom > max_headroom) { |
|
|
|
best = subproxy; |
|
|
|
best = subproxy; |
|
|
|
most_headroom = subproxy_headroom; |
|
|
|
max_headroom = subproxy_headroom; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (best && best->id < best_id) { |
|
|
|
if (best && best->id < best_id) { |
|
|
|