diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-21 16:03:59 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-22 10:57:29 +0100 |
commit | 76530e7356c3741bb91e482b4727f1fab68c817a (patch) | |
tree | 53dac89d746a53ddc0e85e0d3285d060464a18b8 /src/libutil/libev_helper.c | |
parent | 25707133ae54daec513c3f8e3a6090f74d6e3f67 (diff) | |
download | rspamd-76530e7356c3741bb91e482b4727f1fab68c817a.tar.gz rspamd-76530e7356c3741bb91e482b4727f1fab68c817a.zip |
[Minor] Fix some more issues with timeouts
Diffstat (limited to 'src/libutil/libev_helper.c')
-rw-r--r-- | src/libutil/libev_helper.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libutil/libev_helper.c b/src/libutil/libev_helper.c index 45e118e28..8a2cdc677 100644 --- a/src/libutil/libev_helper.c +++ b/src/libutil/libev_helper.c @@ -98,13 +98,17 @@ rspamd_ev_watcher_reschedule (struct ev_loop *loop, ev_io_start (EV_A_ &ev->io); } else { - ev_io_set (&ev->io, ev->io.fd, what); + ev->io.data = ev; + ev_io_init (&ev->io, rspamd_ev_watcher_io_cb, ev->io.fd, what); ev_io_start (EV_A_ &ev->io); } - if (!(ev_is_active (&ev->tm) || ev_is_pending (&ev->tm))) { - ev_timer_set (&ev->tm, ev->timeout, 0.0); - ev_timer_start (EV_A_ &ev->tm); + if (ev->timeout > 0) { + if (!(ev_is_active (&ev->tm) || ev_is_pending (&ev->tm))) { + ev->tm.data = ev; + ev_timer_init (&ev->tm, rspamd_ev_watcher_timer_cb, ev->timeout, 0.0); + ev_timer_start (EV_A_ &ev->tm); + } } ev->last_activity = ev_now (EV_A); |