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

Function cr_status_update

modules/drouting/dr_clustering.c:204–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203
204static int cr_status_update(bin_packet_t *packet)
205{
206 struct head_db *part;
207 str cr_id;
208 str part_name;
209 int flags;
210 pcr_t *cr;
211
212 bin_pop_str(packet, &part_name);
213 bin_pop_str(packet, &cr_id);
214 bin_pop_int(packet, &flags);
215
216 part = get_partition( &part_name );
217 if (part==NULL || part->rdata==NULL)
218 return -1;
219
220 lock_start_read(part->ref_lock);
221
222 cr = get_carrier_by_id(part->rdata->carriers_tree, &cr_id);
223 if (cr) {
224 if ((cr->flags&DR_CR_FLAG_IS_OFF)!=flags) {
225 /* import the status flags */
226 cr->flags = ((~DR_CR_FLAG_IS_OFF)&cr->flags)|(DR_CR_FLAG_IS_OFF&flags);
227 /* set the DIRTY flag to force flushing to DB */
228 cr->flags |= DR_CR_FLAG_DIRTY;
229 dr_raise_cr_event( part, cr, MI_SSTR("replicated info"));
230 }
231 lock_stop_read(part->ref_lock);
232 return 0;
233 }
234
235 lock_stop_read(part->ref_lock);
236
237 return -1;
238}
239
240
241static void dr_recv_sync_packet(bin_packet_t *packet)

Callers 2

dr_recv_sync_packetFunction · 0.85
receive_dr_binary_packetFunction · 0.85

Calls 5

bin_pop_strFunction · 0.85
bin_pop_intFunction · 0.85
get_carrier_by_idFunction · 0.85
dr_raise_cr_eventFunction · 0.85
get_partitionFunction · 0.70

Tested by

no test coverage detected