From 5a19bd0e4aab0c486e464474ffebe5f1af5d81c8 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 6 Feb 2015 21:19:21 +1100 Subject: [PATCH] Send a reconnect if we detect a changed subscription on the current proxy --- src/stratifier.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index a6431251..b8639a32 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1009,6 +1009,17 @@ static proxy_t *proxy_by_id(sdata_t *sdata, const int id) static void reconnect_clients(sdata_t *sdata, const char *cmd); static void _update_notify(ckpool_t *ckp, const int id); +static proxy_t *current_proxy(sdata_t *sdata) +{ + proxy_t *proxy; + + mutex_lock(&sdata->proxy_lock); + proxy = sdata->proxy; + mutex_unlock(&sdata->proxy_lock); + + return proxy; +} + static void update_subscribe(ckpool_t *ckp, const char *cmd) { sdata_t *sdata = ckp->data; @@ -1081,23 +1092,11 @@ static void update_subscribe(ckpool_t *ckp, const char *cmd) json_decref(val); /* Notify implied required now too */ _update_notify(ckp, id); - if (reconnect) + if (reconnect || proxy == current_proxy(sdata)) reconnect_clients(sdata, ""); } static void update_diff(ckpool_t *ckp); -#if 0 -static proxy_t *current_proxy(sdata_t *sdata) -{ - proxy_t *proxy; - - mutex_lock(&sdata->proxy_lock); - proxy = sdata->proxy; - mutex_unlock(&sdata->proxy_lock); - - return proxy; -} -#endif static void _update_notify(ckpool_t *ckp, const int id) {