diff --git a/modules/clusterer/api.h b/modules/clusterer/api.h index c955d041106..4125ea3bff0 100644 --- a/modules/clusterer/api.h +++ b/modules/clusterer/api.h @@ -179,6 +179,7 @@ typedef int (*register_capability_f)(str *cap, cl_packet_cb_f packet_cb, * Request to synchronize data for a given capability from another node. */ typedef int (*request_sync_f)(str * capability, int cluster_id); + /* * Returns a BIN packet in which to include a distinct "chunk" of data * (e.g. info about a single usrloc contact) to sync. diff --git a/modules/clusterer/sync.c b/modules/clusterer/sync.c index 2fbef9d441e..da66172049e 100644 --- a/modules/clusterer/sync.c +++ b/modules/clusterer/sync.c @@ -96,6 +96,8 @@ int cl_request_sync(str *capability, int cluster_id) LM_DBG("requesting %.*s sync in cluster %d\n", capability->len, capability->s, cluster_id); + lock_start_read(cl_list_lock); + cluster = get_cluster_by_id(cluster_id); if (!cluster) { LM_ERR("Unknown cluster [%d]\n", cluster_id); @@ -151,6 +153,8 @@ int cl_request_sync(str *capability, int cluster_id) } } + lock_stop_read(cl_list_lock); + return 0; }