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

Function lb_reload_data

modules/load_balancer/load_balancer.c:316–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314
315
316static inline int lb_reload_data( void )
317{
318 struct lb_data *new_data;
319 struct lb_data *old_data;
320
321 new_data = load_lb_data();
322 if ( new_data==0 ) {
323 LM_CRIT("failed to load load-balancing info\n");
324 return -1;
325 }
326
327 lock_start_write( ref_lock );
328
329 /* no more activ readers -> do the swapping */
330 old_data = *curr_data;
331 *curr_data = new_data;
332
333 lock_stop_write( ref_lock );
334
335 /* destroy old data */
336 if (old_data) {
337 /* copy the state of the destinations from the old set
338 * (for the matching ids) */
339 lb_inherit_state( old_data, new_data);
340 free_lb_data( old_data );
341 }
342
343 /* generate new blacklist from the routing info */
344 populate_lb_bls((*curr_data)->dsts);
345
346 return 0;
347}
348
349
350

Callers 2

mod_initFunction · 0.85
mi_lb_reloadFunction · 0.85

Calls 4

load_lb_dataFunction · 0.85
lb_inherit_stateFunction · 0.85
free_lb_dataFunction · 0.85
populate_lb_blsFunction · 0.85

Tested by

no test coverage detected