summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-02-20 08:34:48 -0500
committerFlorin Coras <florin.coras@gmail.com>2018-02-20 16:14:10 +0000
commitad099335c1c2de17fb0b3b29b008ef8623ee93c0 (patch)
tree468b2c93c119cd8020bf7f3c89fc6867b8ba47a2
parent9b79377ac163c765152d885037374eafd5df9b2f (diff)
Reset expired timer vector length after callback
Otherwise, in a "catch-up / multiple tick" case, the code will repeatedly hand previously-processed expired timer handles to the user callback. Change-Id: Idef4f242279ea41cb557bb6cff5984de02a6503d Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/vppinfra/tw_timer_template.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vppinfra/tw_timer_template.c b/src/vppinfra/tw_timer_template.c
index abad3718b6f..a6d26d7991d 100644
--- a/src/vppinfra/tw_timer_template.c
+++ b/src/vppinfra/tw_timer_template.c
@@ -738,7 +738,10 @@ static inline
{
/* The callback is optional. We return the u32 * handle vector */
if (tw->expired_timer_callback)
- tw->expired_timer_callback (callback_vector);
+ {
+ tw->expired_timer_callback (callback_vector);
+ vec_reset_length (callback_vector);
+ }
tw->expired_timer_handles = callback_vector;
}