Browse Source

Use a global notify id counter in proxy mode to avoid clashes

master
Con Kolivas 10 years ago
parent
commit
47519286a4
  1. 5
      src/generator.c

5
src/generator.c

@ -104,7 +104,6 @@ struct proxy_instance {
pthread_mutex_t notify_lock; pthread_mutex_t notify_lock;
notify_instance_t *notify_instances; notify_instance_t *notify_instances;
notify_instance_t *current_notify; notify_instance_t *current_notify;
int notify_id;
pthread_t pth_precv; pthread_t pth_precv;
pthread_t pth_psend; pthread_t pth_psend;
@ -122,6 +121,8 @@ struct proxy_instance {
typedef struct proxy_instance proxy_instance_t; 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 ckmsgq_t *srvchk; // Server check message queue
static bool server_alive(ckpool_t *ckp, server_instance_t *si, bool pinging) 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); ni->notify_time = time(NULL);
mutex_lock(&proxi->notify_lock); mutex_lock(&proxi->notify_lock);
ni->id = proxi->notify_id++; ni->id = proxy_notify_id++;
HASH_ADD_INT(proxi->notify_instances, id, ni); HASH_ADD_INT(proxi->notify_instances, id, ni);
proxi->current_notify = ni; proxi->current_notify = ni;
mutex_unlock(&proxi->notify_lock); mutex_unlock(&proxi->notify_lock);

Loading…
Cancel
Save