commit 0dba9ab: [Minor] Fix timeouts mess
Vsevolod Stakhov
vsevolod at highsecure.ru
Sat Jun 22 12:14:52 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-06-21 14:11:33 +0100
URL: https://github.com/rspamd/rspamd/commit/0dba9ab49a327fd1a9bb2baa9da860b62d7232e5
[Minor] Fix timeouts mess
---
src/libserver/protocol.c | 1 +
src/libutil/libev_helper.c | 11 +++++++++--
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
More information about the Commits
mailing list