]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add assertions to prevent scheduling of uninitialised watchers libev-migration 2931/head
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 22 Jun 2019 08:52:22 +0000 (09:52 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 22 Jun 2019 09:57:29 +0000 (10:57 +0100)
src/libutil/libev_helper.c

index 8a2cdc677c0ae0985304a4e9caefa3025932a37c..81a23dea619b7c1b479830d554eb47c2a632d1a9 100644 (file)
@@ -64,6 +64,8 @@ rspamd_ev_watcher_start (struct ev_loop *loop,
                                                 struct rspamd_io_ev *ev,
                                                 ev_tstamp timeout)
 {
+       g_assert (ev->cb != NULL);
+
        ev->last_activity = ev_now (EV_A);
        ev_io_start (EV_A_ &ev->io);
 
@@ -92,6 +94,8 @@ rspamd_ev_watcher_reschedule (struct ev_loop *loop,
                                                          struct rspamd_io_ev *ev,
                                                          short what)
 {
+       g_assert (ev->cb != NULL);
+
        if (ev_is_pending (&ev->io) || ev_is_active (&ev->io)) {
                ev_io_stop (EV_A_ &ev->io);
                ev_io_set (&ev->io, ev->io.fd, what);