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

Function receive_sync_request

modules/usrloc/ul_cluster.c:987–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985}
986
987static int receive_sync_request(int node_id)
988{
989 struct ct_match cmatch = {CT_MATCH_CONTACT_CALLID, NULL};
990 bin_packet_t *sync_packet;
991 dlist_t *dl;
992 udomain_t *dom;
993 map_iterator_t it;
994 struct urecord *r;
995 ucontact_t* c;
996 void **p;
997 int i;
998
999 for (dl = root; dl; dl = dl->next) {
1000 dom = dl->d;
1001 for(i = 0; i < dom->size; i++) {
1002 lock_ulslot(dom, i);
1003 for (map_first(dom->table[i].records, &it);
1004 iterator_is_valid(&it);
1005 iterator_next(&it)) {
1006
1007 p = iterator_val(&it);
1008 if (p == NULL)
1009 goto error_unlock;
1010 r = (urecord_t *)*p;
1011
1012 sync_packet = clusterer_api.sync_chunk_start(&contact_repl_cap,
1013 location_cluster, node_id, UL_BIN_VERSION);
1014 if (!sync_packet)
1015 goto error_unlock;
1016
1017 /* urecord in this chunk */
1018 bin_push_int(sync_packet, 0);
1019 bin_push_urecord(sync_packet, r);
1020
1021 for (c = r->contacts; c; c = c->next) {
1022 sync_packet = clusterer_api.sync_chunk_start(&contact_repl_cap,
1023 location_cluster, node_id, UL_BIN_VERSION);
1024 if (!sync_packet)
1025 goto error_unlock;
1026
1027 /* ucontact in this chunk */
1028 bin_push_int(sync_packet, 1);
1029 bin_push_contact(sync_packet, r, c, &cmatch);
1030 }
1031 }
1032 unlock_ulslot(dom, i);
1033 }
1034 }
1035
1036 return 0;
1037
1038error_unlock:
1039 unlock_ulslot(dom, i);
1040 return -1;
1041}
1042
1043void receive_cluster_event(enum clusterer_event ev, int node_id)
1044{

Callers 1

receive_cluster_eventFunction · 0.70

Calls 9

lock_ulslotFunction · 0.85
map_firstFunction · 0.85
iterator_is_validFunction · 0.85
iterator_nextFunction · 0.85
iterator_valFunction · 0.85
bin_push_intFunction · 0.85
bin_push_urecordFunction · 0.85
bin_push_contactFunction · 0.85
unlock_ulslotFunction · 0.85

Tested by

no test coverage detected