aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-21 14:11:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-22 10:57:29 +0100
commit0dba9ab49a327fd1a9bb2baa9da860b62d7232e5 (patch)
tree1409f72a66c9a26c3ecd83bf66d1465a1ee68f67
parent562fac4c3c2045cc3a65f0bb37db0a7b2d47c6cb (diff)
downloadrspamd-0dba9ab49a327fd1a9bb2baa9da860b62d7232e5.tar.gz
rspamd-0dba9ab49a327fd1a9bb2baa9da860b62d7232e5.zip
[Minor] Fix timeouts mess
-rw-r--r--src/libserver/protocol.c1
-rw-r--r--src/libutil/libev_helper.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index c75a402a4..4f854328f 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -1786,6 +1786,7 @@ rspamd_protocol_write_reply (struct rspamd_task *task, ev_tstamp timeout)
msg->flags |= RSPAMD_HTTP_FLAG_SPAMC;
}
+ ev_now_update (task->event_loop);
msg->date = ev_time ();
msg_debug_protocol ("writing reply to client");
diff --git a/src/libutil/libev_helper.c b/src/libutil/libev_helper.c
index ac0f1fc0d..45e118e28 100644
--- a/src/libutil/libev_helper.c
+++ b/src/libutil/libev_helper.c
@@ -38,8 +38,8 @@ rspamd_ev_watcher_timer_cb (EV_P_ struct ev_timer *w, int revents)
}
else {
/* Start another cycle as there was some activity */
- ev_timer_set (w, after, 0.);
- ev_timer_start (EV_A_ w);
+ w->repeat = after;
+ ev_timer_again (EV_A_ w);
}
}
@@ -101,4 +101,11 @@ rspamd_ev_watcher_reschedule (struct ev_loop *loop,
ev_io_set (&ev->io, 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);
+ }
+
+ ev->last_activity = ev_now (EV_A);
} \ No newline at end of file