From: Vsevolod Stakhov Date: Fri, 21 Jun 2019 13:11:33 +0000 (+0100) Subject: [Minor] Fix timeouts mess X-Git-Tag: 2.0~755^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0dba9ab49a327fd1a9bb2baa9da860b62d7232e5;p=rspamd.git [Minor] Fix timeouts mess --- 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