| 314 | |
| 315 | |
| 316 | static 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 |
no test coverage detected