MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / ul_init_cluster

Function ul_init_cluster

modules/usrloc/ul_cluster.c:35–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33str ul_shtag_key = str_init("_st");
34
35int ul_init_cluster(void)
36{
37 if (location_cluster == 0)
38 return 0;
39
40 if (location_cluster < 0) {
41 LM_ERR("Invalid 'location_cluster'! It must be a positive integer!\n");
42 return -1;
43 }
44
45 if (load_clusterer_api(&clusterer_api) != 0) {
46 LM_ERR("failed to load clusterer API\n");
47 return -1;
48 }
49
50 /* register handler for processing usrloc packets to the clusterer module */
51 if (clusterer_api.register_capability(&contact_repl_cap,
52 receive_binary_packets, receive_cluster_event, location_cluster,
53 rr_persist == RRP_SYNC_FROM_CLUSTER? 1 : 0,
54 (cluster_mode == CM_FEDERATION
55 || cluster_mode == CM_FEDERATION_CACHEDB) ?
56 NODE_CMP_EQ_SIP_ADDR : NODE_CMP_ANY) < 0) {
57 LM_ERR("cannot register callbacks to clusterer module!\n");
58 return -1;
59 }
60
61 if (rr_persist == RRP_SYNC_FROM_CLUSTER &&
62 clusterer_api.request_sync(&contact_repl_cap, location_cluster, 0) < 0)
63 LM_ERR("Sync request failed\n");
64
65 return 0;
66}
67
68/* packet sending */
69

Callers 1

mod_initFunction · 0.85

Calls 1

load_clusterer_apiFunction · 0.85

Tested by

no test coverage detected