From: Vsevolod Stakhov Date: Sat, 22 Jun 2019 08:52:22 +0000 (+0100) Subject: [Minor] Add assertions to prevent scheduling of uninitialised watchers X-Git-Tag: 2.0~755^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Flibev-migration;p=thirdparty%2Frspamd.git [Minor] Add assertions to prevent scheduling of uninitialised watchers --- diff --git a/src/libutil/libev_helper.c b/src/libutil/libev_helper.c index 8a2cdc677c..81a23dea61 100644 --- a/src/libutil/libev_helper.c +++ b/src/libutil/libev_helper.c @@ -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);