Skip to content

Commit

Permalink
usrloc: improved clusterer api usage for replication
Browse files Browse the repository at this point in the history
  • Loading branch information
eseanucristian committed Aug 24, 2015
1 parent 778fe7d commit 2dd5b4c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 131 deletions.
19 changes: 11 additions & 8 deletions modules/usrloc/ul_mod.c
Expand Up @@ -134,8 +134,7 @@ static char *nat_bflag_str = 0;
unsigned int init_flag = 0;

/* usrloc data replication using the bin interface */
int accept_replicated_udata;
struct replication_dest *replication_dests;
int accept_replicated_udata = 0;
int ul_replicate_cluster = 0;

db_con_t* ul_dbh = 0; /* Database connection handle */
Expand Down Expand Up @@ -374,17 +373,21 @@ static int mod_init(void)
return -1;
}



if( (ul_replicate_cluster > 0 || accept_replicated_udata > 0)
&& load_clusterer_api(&clusterer_api)!=0){
LM_DBG("failed to find clusterer API - is clusterer module loaded?\n");
return -1;
}

/* register handler for processing usrloc packets from the bin interface */
if (accept_replicated_udata &&
bin_register_cb(repl_module_name.s, receive_binary_packet) < 0) {
if (accept_replicated_udata > 0 &&
bin_register_cb(repl_module_name.s, receive_binary_packet, NULL) < 0) {
LM_ERR("cannot register binary packet callback!\n");
return -1;
}

if(ul_replicate_cluster > 0 && load_clusterer_api(&clusterer_api)!=0){
LM_DBG("failed to find clusterer API - is clusterer module loaded?\n");
return -1;
}

if(ul_replicate_cluster < 0){
ul_replicate_cluster = 0;
Expand Down

0 comments on commit 2dd5b4c

Please sign in to comment.