Browse Source

Don't create subproxies except when appropriate

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

16
src/stratifier.c

@ -1283,9 +1283,9 @@ static void update_notify(ckpool_t *ckp, const char *cmd)
}
json_get_int(&id, val, "proxy");
json_get_int(&subid, val, "subproxy");
proxy = subproxy_by_id(sdata, id, subid);
if (unlikely(!proxy->subscribed)) {
LOGNOTICE("No valid proxy %d:%d subscription to update notify yet", id, subid);
proxy = existing_subproxy(sdata, id, subid);
if (unlikely(!proxy || !proxy->subscribed)) {
LOGINFO("No valid proxy %d:%d subscription to update notify yet", id, subid);
goto out;
}
if (!subid)
@ -1397,7 +1397,11 @@ static void update_diff(ckpool_t *ckp, const char *cmd)
LOGNOTICE("Got updated diff for proxy %d", id);
else
LOGINFO("Got updated diff for proxy %d:%d", id, subid);
proxy = subproxy_by_id(sdata, id, subid);
proxy = existing_subproxy(sdata, id, subid);
if (!proxy) {
LOGINFO("No existing subproxy %d:%d to update diff", id, subid);
return;
}
/* We only really care about integer diffs so clamp the lower limit to
* 1 or it will round down to zero. */
@ -2043,7 +2047,9 @@ static void dead_proxy(sdata_t *sdata, const char *buf)
proxy_t *proxy;
sscanf(buf, "deadproxy=%d:%d", &id, &subid);
proxy = subproxy_by_id(sdata, id, subid);
proxy = existing_subproxy(sdata, id, subid);
if (!proxy)
return;
proxy->dead = true;
LOGNOTICE("Stratifier dropping clients from proxy %d:%d", id, subid);

Loading…
Cancel
Save