]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Have to use O(N) move for inserting deffered events
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 28 Mar 2025 02:33:34 +0000 (20:33 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 28 Mar 2025 04:19:21 +0000 (22:19 -0600)
src/lib/util/timer.c

index 5ce3362ecdccaea377166ccf279e523b5db4d4ec..888615e67b65520737fb293c6801abbe65d5ae54 100644 (file)
@@ -898,6 +898,7 @@ static int timer_list_lst_deferred(fr_timer_list_t *tl)
  */
 static int timer_list_ordered_deferred(fr_timer_list_t *tl)
 {
+       fr_timer_t *ev;
 #ifndef NDEBUG
        {
                fr_timer_t *head, *tail;
@@ -916,10 +917,12 @@ static int timer_list_ordered_deferred(fr_timer_list_t *tl)
 #endif
 
        /*
-        *      O(1) operation.  Much better than moving the
-        *      events individually.
+        *      Can't use timer_move_head as entry positions
+        *      for the two lists are different.
         */
-       timer_move_head(&tl->ordered, &tl->deferred);
+       while ((ev = timer_pop_head((&tl->deferred)))) {
+               timer_insert_tail(&tl->ordered, ev);
+       }
 
        return 0;
 }