| 367 | |
| 368 | |
| 369 | void 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 | |
| 407 | static int get_dst_load(struct lb_resource **res, unsigned int res_no, |
no test coverage detected