Browse Source

Tweak reconnects

master
Con Kolivas 10 years ago
parent
commit
6f08c301e9
  1. 16
      src/stratifier.c

16
src/stratifier.c

@ -1160,9 +1160,11 @@ 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;
if (headroom < 1)
break;
headroom--; headroom--;
reconnects++; reconnects++;
if (client->reconnect && headroom > 0) if (client->reconnect)
reconnect_client(sdata, client); reconnect_client(sdata, client);
else else
client->reconnect = true; client->reconnect = true;
@ -1172,9 +1174,9 @@ static void reconnect_clients(sdata_t *sdata)
if (reconnects) { if (reconnects) {
LOGNOTICE("%d clients flagged for reconnect to proxy %ld", reconnects, LOGNOTICE("%d clients flagged for reconnect to proxy %ld", reconnects,
proxy->id); proxy->id);
if (headroom < 42)
generator_recruit(sdata->ckp);
} }
if (headroom < 42)
generator_recruit(sdata->ckp);
} }
#if 0 #if 0
@ -1207,9 +1209,11 @@ static void dead_proxyid(sdata_t *sdata, const int64_t id, const int subid)
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;
if (headroom < 1)
break;
headroom--; headroom--;
reconnects++; reconnects++;
if (client->reconnect && headroom > 0) if (client->reconnect)
reconnect_client(sdata, client); reconnect_client(sdata, client);
else else
client->reconnect = true; client->reconnect = true;
@ -1219,9 +1223,9 @@ static void dead_proxyid(sdata_t *sdata, const int64_t id, const int subid)
if (reconnects) { if (reconnects) {
LOGNOTICE("%d clients flagged to reconnect from dead proxy %ld:%d", reconnects, LOGNOTICE("%d clients flagged to reconnect from dead proxy %ld:%d", reconnects,
id, subid); id, subid);
if (headroom < 42)
generator_recruit(sdata->ckp);
} }
if (headroom < 42)
generator_recruit(sdata->ckp);
} }
static void update_subscribe(ckpool_t *ckp, const char *cmd) static void update_subscribe(ckpool_t *ckp, const char *cmd)

Loading…
Cancel
Save