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

Function free_lb_data

modules/load_balancer/lb_data.c:369–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367
368
369void free_lb_data(struct lb_data *data)
370{
371 struct lb_resource *lbr1, *lbr2;
372 struct lb_dst *lbd1, *lbd2;
373 str lb_str = { MI_SSTR("load_balancer") };
374
375 if (data==NULL)
376 return;
377
378 /* free resources */
379 for( lbr1=data->resources ; lbr1 ; ) {
380 lbr2 = lbr1;
381 lbr1 = lbr1->next;
382 if (lbr2->dst_bitmap)
383 shm_free(lbr2->dst_bitmap);
384 if (lbr2->lock) {
385 lock_destroy( lbr2->lock );
386 lock_dealloc( lbr2->lock );
387 }
388 shm_free(lbr2);
389 }
390
391 /* free destinations */
392 for( lbd1=data->dsts ; lbd1 ; ) {
393 lbd2 = lbd1;
394 lbd1 = lbd1->next;
395 if (lbd2->fs_sock) {
396 fs_api.put_stats_evs(lbd2->fs_sock, &lb_str);
397 }
398 shm_free(lbd2);
399 }
400
401 shm_free(data);
402
403 return;
404}
405
406
407static int get_dst_load(struct lb_resource **res, unsigned int res_no,

Callers 3

lb_reload_dataFunction · 0.85
mod_destroyFunction · 0.85
load_lb_dataFunction · 0.85

Calls 2

shm_freeFunction · 0.85
lock_destroyFunction · 0.85

Tested by

no test coverage detected