Browse Source

Send reconnect instead of dropall to stratifier when killing an upstream proxy and drop them lazily

master
Con Kolivas 10 years ago
parent
commit
9c1e5f2332
  1. 2
      src/generator.c
  2. 9
      src/stratifier.c

2
src/generator.c

@ -1457,8 +1457,8 @@ static void kill_proxy(ckpool_t *ckp, proxy_instance_t *proxi)
notify_instance_t *ni, *tmp;
connsock_t *cs;
send_proc(ckp->stratifier, "reconnect");
send_proc(ckp->connector, "reject");
send_proc(ckp->stratifier, "dropall");
if (!proxi) // This shouldn't happen
return;

9
src/stratifier.c

@ -1465,6 +1465,7 @@ static void stratum_broadcast_message(sdata_t *sdata, const char *msg)
static void reconnect_clients(sdata_t *sdata, const char *cmd)
{
char *port = strdupa(cmd), *url = NULL;
stratum_instance_t *client, *tmp;
json_t *json_msg;
strsep(&port, ":");
@ -1480,6 +1481,14 @@ static void reconnect_clients(sdata_t *sdata, const char *cmd)
JSON_CPACK(json_msg, "{sosss[]}", "id", json_null(), "method", "client.reconnect",
"params");
stratum_broadcast(sdata, json_msg);
/* Tag all existing clients as dropped now so they can be removed
* lazily */
ck_wlock(&sdata->instance_lock);
HASH_ITER(hh, sdata->stratum_instances, client, tmp) {
client->dropped = true;
}
ck_wunlock(&sdata->instance_lock);
}
static void reset_bestshares(sdata_t *sdata)

Loading…
Cancel
Save