]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: make event_source_time_prioq_reshuffle() accept all event source type
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Jun 2021 17:03:02 +0000 (02:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Jun 2021 17:34:16 +0000 (02:34 +0900)
But it does nothing for an event source which is neither a timer nor
ratelimited.

src/libsystemd/sd-event/sd-event.c

index b2c2074e81720dddd7fc5cf3836e94eeee448f83..bf27fff84c9e13e6ba1f3b275a9654d64e39c416 100644 (file)
@@ -771,14 +771,15 @@ static void event_source_time_prioq_reshuffle(sd_event_source *s) {
         assert(s);
 
         /* Called whenever the event source's timer ordering properties changed, i.e. time, accuracy,
-         * pending, enable state. Makes sure the two prioq's are ordered properly again. */
+         * pending, enable state, and ratelimiting state. Makes sure the two prioq's are ordered
+         * properly again. */
 
         if (s->ratelimited)
                 d = &s->event->monotonic;
-        else {
-                assert(EVENT_SOURCE_IS_TIME(s->type));
+        else if (EVENT_SOURCE_IS_TIME(s->type))
                 assert_se(d = event_get_clock_data(s->event, s->type));
-        }
+        else
+                return; /* no-op for an event source which is neither a timer nor ratelimited. */
 
         prioq_reshuffle(d->earliest, s, &s->earliest_index);
         prioq_reshuffle(d->latest, s, &s->latest_index);