Browse Source

Always update the subscription and notification details for every proxy updated, sending a reconnect instead when the proxy changes

master
Con Kolivas 10 years ago
parent
commit
fea1ea2953
  1. 31
      src/generator.c

31
src/generator.c

@ -1367,18 +1367,6 @@ static void passthrough_add_send(proxy_instance_t *proxi, const char *msg)
ckmsgq_add(proxi->passsends, pm); ckmsgq_add(proxi->passsends, pm);
} }
static int current_proxy_id(gdata_t *gdata)
{
int ret = 0;
mutex_lock(&gdata->lock);
if (gdata->proxy)
ret = gdata->proxy->id;
mutex_unlock(&gdata->lock);
return ret;
}
static bool proxy_alive(ckpool_t *ckp, server_instance_t *si, proxy_instance_t *proxi, static bool proxy_alive(ckpool_t *ckp, server_instance_t *si, proxy_instance_t *proxi,
connsock_t *cs, bool pinging) connsock_t *cs, bool pinging)
{ {
@ -1428,17 +1416,12 @@ out:
/* Close and invalidate the file handle */ /* Close and invalidate the file handle */
Close(cs->fd); Close(cs->fd);
} else { } else {
keep_sockalive(cs->fd); char msg[128];
/* If this isn't a new higher priority proxy we won't be
* issuing a reconnect so tell the stratifier to get the
* subscription and notification data without reconnecting. */
if (proxi->id > current_proxy_id(ckp->data)) {
char *msg;
ASPRINTF(&msg, "subscribe=%d", proxi->id); keep_sockalive(cs->fd);
snprintf(msg, 127, "subscribe=%d", proxi->id);
send_proc(ckp->stratifier, msg); send_proc(ckp->stratifier, msg);
free(msg); proxi->notified = false;
}
} }
return ret; return ret;
} }
@ -1672,11 +1655,7 @@ reconnect:
connsock_t *cs = proxi->cs; connsock_t *cs = proxi->cs;
LOGWARNING("Successfully connected to %s:%s as proxy", LOGWARNING("Successfully connected to %s:%s as proxy",
cs->url, cs->port); cs->url, cs->port);
/* Sending subscribe implies stratifier will also do a notify */ send_proc(ckp->stratifier, "reconnect");
dealloc(buf);
ASPRINTF(&buf, "subscribe=%d", proxi->id);
send_proc(ckp->stratifier, buf);
proxi->notified = false;
} }
} }
retry: retry:

Loading…
Cancel
Save