From 47519286a4e5ab3330d794cf368e53a1cd92e6d9 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 16 Sep 2014 11:39:35 +1000 Subject: [PATCH] Use a global notify id counter in proxy mode to avoid clashes --- src/generator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index 67411b3d..b3fdbd36 100644 --- a/src/generator.c +++ b/src/generator.c @@ -104,7 +104,6 @@ struct proxy_instance { pthread_mutex_t notify_lock; notify_instance_t *notify_instances; notify_instance_t *current_notify; - int notify_id; pthread_t pth_precv; pthread_t pth_psend; @@ -122,6 +121,8 @@ struct proxy_instance { typedef struct proxy_instance proxy_instance_t; +static int proxy_notify_id; // Globally increasing notify id + static ckmsgq_t *srvchk; // Server check message queue static bool server_alive(ckpool_t *ckp, server_instance_t *si, bool pinging) @@ -729,7 +730,7 @@ static bool parse_notify(proxy_instance_t *proxi, json_t *val) ni->notify_time = time(NULL); mutex_lock(&proxi->notify_lock); - ni->id = proxi->notify_id++; + ni->id = proxy_notify_id++; HASH_ADD_INT(proxi->notify_instances, id, ni); proxi->current_notify = ni; mutex_unlock(&proxi->notify_lock);