Browse Source

Do not switch more clients than we have headroom

master
Con Kolivas 10 years ago
parent
commit
dd22d73145
  1. 12
      src/stratifier.c

12
src/stratifier.c

@ -1163,7 +1163,8 @@ static void reconnect_clients(sdata_t *sdata)
HASH_ITER(hh, sdata->stratum_instances, client, tmpclient) { HASH_ITER(hh, sdata->stratum_instances, client, tmpclient) {
if (client->proxyid == proxy->id) if (client->proxyid == proxy->id)
continue; continue;
headroom--; if (--headroom < 0)
break;
reconnects++; reconnects++;
if (client->reconnect) if (client->reconnect)
reconnect_client(sdata, client); reconnect_client(sdata, client);
@ -1177,7 +1178,8 @@ static void reconnect_clients(sdata_t *sdata)
proxy->id); proxy->id);
if (headroom < 42) if (headroom < 42)
generator_recruit(sdata->ckp); generator_recruit(sdata->ckp);
} } else if (headroom < 0)
generator_recruit(sdata->ckp);
} }
static proxy_t *current_proxy(sdata_t *sdata) static proxy_t *current_proxy(sdata_t *sdata)
@ -2251,7 +2253,8 @@ static void dead_proxy(sdata_t *sdata, const char *buf)
HASH_ITER(hh, sdata->stratum_instances, client, tmp) { HASH_ITER(hh, sdata->stratum_instances, client, tmp) {
if (client->proxyid != id || client->subproxyid != subid) if (client->proxyid != id || client->subproxyid != subid)
continue; continue;
headroom--; if (--headroom < 0)
break;
reconnects++; reconnects++;
if (client->reconnect) if (client->reconnect)
reconnect_client(sdata, client); reconnect_client(sdata, client);
@ -2265,7 +2268,8 @@ static void dead_proxy(sdata_t *sdata, const char *buf)
id, subid); id, subid);
if (headroom < 42) if (headroom < 42)
generator_recruit(sdata->ckp); generator_recruit(sdata->ckp);
} } else if (headroom < 0)
generator_recruit(sdata->ckp);
} }
/* Must hold a reference */ /* Must hold a reference */

Loading…
Cancel
Save