From b831aea6f378be333788590f5cb3508753083df5 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 6 Oct 2024 07:25:49 +0200 Subject: [PATCH] Clear all group timers before removing groups Ensure all group timers are stopped when stopping interfaces. Fixes #56 Signed-off-by: Joachim Wiberg --- src/vif.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/vif.c b/src/vif.c index 4ca9cac..7bb3a9f 100644 --- a/src/vif.c +++ b/src/vif.c @@ -584,6 +584,16 @@ static void stop_vif(vifi_t vifi) */ TAILQ_FOREACH_SAFE(al, &uv->uv_groups, al_link, tmp) { TAILQ_REMOVE(&uv->uv_groups, al, al_link); + + if (al->al_query > 0) + al->al_query = timer_clear(al->al_query); + + if (al->al_timerid > 0) + al->al_timerid = timer_clear(al->al_timerid); + + if (al->al_pv_timerid > 0) + al->al_pv_timerid = timer_clear(al->al_pv_timerid); + free(al); } @@ -648,6 +658,16 @@ void stop_all_vifs(void) TAILQ_FOREACH_SAFE(al, &uv->uv_groups, al_link, tmp) { TAILQ_REMOVE(&uv->uv_groups, al, al_link); + + if (al->al_query > 0) + al->al_query = timer_clear(al->al_query); + + if (al->al_timerid > 0) + al->al_timerid = timer_clear(al->al_timerid); + + if (al->al_pv_timerid > 0) + al->al_pv_timerid = timer_clear(al->al_pv_timerid); + free(al); }