Reset expired timer vector length after callback 79/10679/2
authorDave Barach <dave@barachs.net>
Tue, 20 Feb 2018 13:34:48 +0000 (08:34 -0500)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 20 Feb 2018 16:14:10 +0000 (16:14 +0000)
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>
src/vppinfra/tw_timer_template.c

index abad371..a6d26d7 100644 (file)
@@ -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;
        }