Browse Source

Unconditionally drop all clients bound to a proxy should we update its subscribe

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

9
src/stratifier.c

@ -1459,7 +1459,7 @@ static void check_bestproxy(sdata_t *sdata)
LOGNOTICE("Stratifier setting active proxy to %d", changed_id); LOGNOTICE("Stratifier setting active proxy to %d", changed_id);
} }
static void dead_proxyid(sdata_t *sdata, const int id, const int subid) static void dead_proxyid(sdata_t *sdata, const int id, const int subid, const bool replaced)
{ {
stratum_instance_t *client, *tmp; stratum_instance_t *client, *tmp;
int reconnects = 0, proxyid = 0; int reconnects = 0, proxyid = 0;
@ -1469,7 +1469,7 @@ static void dead_proxyid(sdata_t *sdata, const int id, const int subid)
proxy = existing_subproxy(sdata, id, subid); proxy = existing_subproxy(sdata, id, subid);
if (proxy) { if (proxy) {
proxy->dead = true; proxy->dead = true;
if (proxy->global) if (!replaced && proxy->global)
check_bestproxy(sdata); check_bestproxy(sdata);
} }
LOGINFO("Stratifier dropping clients from proxy %d:%d", id, subid); LOGINFO("Stratifier dropping clients from proxy %d:%d", id, subid);
@ -1550,8 +1550,7 @@ static void update_subscribe(ckpool_t *ckp, const char *cmd)
/* Is this a replacement for an existing proxy id? */ /* Is this a replacement for an existing proxy id? */
old = existing_subproxy(sdata, id, subid); old = existing_subproxy(sdata, id, subid);
if (old) { if (old) {
if (old->dead) dead_proxyid(sdata, id, subid, true);
dead_proxyid(sdata, id, subid);
proxy = old; proxy = old;
proxy->dead = false; proxy->dead = false;
} else } else
@ -2449,7 +2448,7 @@ static void dead_proxy(sdata_t *sdata, const char *buf)
int id = 0, subid = 0; int id = 0, subid = 0;
sscanf(buf, "deadproxy=%d:%d", &id, &subid); sscanf(buf, "deadproxy=%d:%d", &id, &subid);
dead_proxyid(sdata, id, subid); dead_proxyid(sdata, id, subid, false);
} }
static void reconnect_client_id(sdata_t *sdata, const int64_t client_id) static void reconnect_client_id(sdata_t *sdata, const int64_t client_id)

Loading…
Cancel
Save