Make IPv4-only sockaddr_from_irc() work properly.
[ircu2.10.12-pk.git] / ircd / ircd_events.c
index ac61fd3c5720493d18344c67f289fe4174515d0d..2de7f20aaba42ae16ef646fe7acd1a04df267efd 100644 (file)
@@ -30,7 +30,7 @@
 #include "ircd_snprintf.h"
 #include "s_debug.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -525,12 +525,19 @@ timer_chg(struct Timer* timer, enum TimerType type, time_t value)
         "timeout %Tu", timer, timer_to_name(timer->t_type), timer->t_value,
         timer_to_name(type), value));
 
-  gen_dequeue(timer); /* remove the timer from the queue */
-
   timer->t_type = type; /* Set the new type and value */
   timer->t_value = value;
   timer->t_expire = 0;
 
+  /* If the timer expiration callback tries to change the timer
+   * expiration, flag the timer but do not dequeue it yet.
+   */
+  if (timer->t_header.gh_flags & GEN_MARKED)
+  {
+    timer->t_header.gh_flags |= GEN_READD;
+    return;
+  }
+  gen_dequeue(timer); /* remove the timer from the queue */
   timer_enqueue(timer); /* re-queue the timer */
 }