aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-29 13:06:23 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-29 13:06:23 +0100
commitb3713de7cefa87af9ed95d091db497cef63502d0 (patch)
treed689606317be5f22ede887fc7ae418247a3bef60 /src/libutil
parent30c0dca001842d9dc009be0ff9ade49b69963bd2 (diff)
downloadrspamd-b3713de7cefa87af9ed95d091db497cef63502d0.tar.gz
rspamd-b3713de7cefa87af9ed95d091db497cef63502d0.zip
[Fix] Fix pending checks for events
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/libev_helper.c6
-rw-r--r--src/libutil/upstream.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/libev_helper.c b/src/libutil/libev_helper.c
index 81a23dea6..65a53d3f7 100644
--- a/src/libutil/libev_helper.c
+++ b/src/libutil/libev_helper.c
@@ -80,7 +80,7 @@ void
rspamd_ev_watcher_stop (struct ev_loop *loop,
struct rspamd_io_ev *ev)
{
- if (ev_is_pending (&ev->io) || ev_is_active (&ev->io)) {
+ if (ev_can_stop (&ev->io)) {
ev_io_stop (EV_A_ &ev->io);
}
@@ -96,7 +96,7 @@ rspamd_ev_watcher_reschedule (struct ev_loop *loop,
{
g_assert (ev->cb != NULL);
- if (ev_is_pending (&ev->io) || ev_is_active (&ev->io)) {
+ if (ev_can_stop (&ev->io)) {
ev_io_stop (EV_A_ &ev->io);
ev_io_set (&ev->io, ev->io.fd, what);
ev_io_start (EV_A_ &ev->io);
@@ -108,7 +108,7 @@ rspamd_ev_watcher_reschedule (struct ev_loop *loop,
}
if (ev->timeout > 0) {
- if (!(ev_is_active (&ev->tm) || ev_is_pending (&ev->tm))) {
+ if (!(ev_can_stop (&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);
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 0b7fd0c2f..177731038 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -172,7 +172,7 @@ rspamd_upstreams_library_config (struct rspamd_config *cfg,
while (cur) {
upstream = cur->data;
- if (!ev_is_active (&upstream->ev) && upstream->ls &&
+ if (!ev_can_stop (&upstream->ev) && upstream->ls &&
!(upstream->flags & RSPAMD_UPSTREAM_FLAG_NORESOLVE)) {
gdouble when = rspamd_time_jitter (upstream->ls->limits.lazy_resolve_time,
upstream->ls->limits.lazy_resolve_time * .1);
@@ -281,7 +281,7 @@ rspamd_upstream_set_active (struct upstream_list *ls, struct upstream *upstream)
if (upstream->ctx && upstream->ctx->configured &&
!(upstream->flags & RSPAMD_UPSTREAM_FLAG_NORESOLVE)) {
- if (ev_is_active (&upstream->ev)) {
+ if (ev_can_stop (&upstream->ev)) {
ev_timer_stop (upstream->ctx->event_loop, &upstream->ev);
}
/* Start lazy names resolution */
@@ -525,7 +525,7 @@ rspamd_upstream_set_inactive (struct upstream_list *ls, struct upstream *upstrea
ntim = rspamd_time_jitter (ls->limits.revive_time,
ls->limits.revive_jitter);
- if (ev_is_active (&upstream->ev)) {
+ if (ev_can_stop (&upstream->ev)) {
ev_timer_stop (upstream->ctx->event_loop, &upstream->ev);
}
@@ -721,7 +721,7 @@ rspamd_upstream_dtor (struct upstream *up)
if (up->ctx) {
- if (ev_is_active (&up->ev)) {
+ if (ev_can_stop (&up->ev)) {
ev_timer_stop (up->ctx->event_loop, &up->ev);
}
@@ -1030,7 +1030,7 @@ rspamd_upstream_restore_cb (gpointer elt, gpointer ls)
/* Here the upstreams list is already locked */
RSPAMD_UPSTREAM_LOCK (up->lock);
- if (ev_is_active (&up->ev)) {
+ if (ev_can_stop (&up->ev)) {
ev_timer_stop (up->ctx->event_loop, &up->ev);
}