Skip to content

Commit

Permalink
[load_balancer] fix chaining and freeing of probing packs
Browse files Browse the repository at this point in the history
Some probing packs may be freed before ending circulating the list (if the prob sending fails), so we need to take care of the linking.
  • Loading branch information
bogdan-iancu committed Oct 18, 2022
1 parent 9f14bb0 commit 2e7c021
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/load_balancer/lb_prober.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void lb_do_probing(struct lb_data *data)
pack->uri.s = (char*)(pack+1);
memcpy(pack->uri.s, dst->uri.s, dst->uri.len);
pack->uri.len = dst->uri.len;
pack->next = NULL;

pack->params.id = dst->id;

Expand All @@ -117,7 +118,9 @@ void lb_do_probing(struct lb_data *data)
lock_stop_read( ref_lock );

/* now send all the probs, outside the lock */
for( pack = pack_head ; pack ; pack=pack->next ) {
for( pack = pack_head ; pack ; pack=pack_last ) {

pack_last = pack->next;

if (lb_tmb.t_request( &lb_probe_method, &pack->uri, &pack->uri,
&lb_probe_from, NULL, NULL, NULL, lb_probing_callback,
Expand Down

0 comments on commit 2e7c021

Please sign in to comment.