From f8e8ab4fd97ebb5777c17a9e5dc9ba2b5c9d6ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Fri, 6 Mar 2009 12:21:58 +0000 Subject: [PATCH] wake recvloopth after SelfCheck (if set), to avoid reloading the DB just before next scan request. git-svn: trunk@4904 --- ChangeLog | 5 +++++ clamd/others.c | 2 +- clamd/server-th.c | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 980ee643b..1ee4b19ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Mar 6 14:21:52 EET 2009 (edwin) +------------------------------------ + * clamd/others.c, clamd/server-th.c: wake recvloopth after SelfCheck + (if set), to avoid reloading the DB just before next scan request. + Fri Mar 6 11:19:32 EET 2009 (edwin) ------------------------------------ * clamav-milter/Makefile.am, clamav-milter/Makefile.in: fix make diff --git a/clamd/others.c b/clamd/others.c index 3791c54ec..0ac2f03c7 100644 --- a/clamd/others.c +++ b/clamd/others.c @@ -454,7 +454,7 @@ int fds_poll_recv(struct fd_data *data, int timeout, int check_signals) } else { if (!closest_timeout) closest_timeout = timeout_at; - else if (timeout_at < closest_timeout) + else if (timeout_at && timeout_at < closest_timeout) closest_timeout = timeout_at; } } diff --git a/clamd/server-th.c b/clamd/server-th.c index cebfd57cf..771ff9ba1 100644 --- a/clamd/server-th.c +++ b/clamd/server-th.c @@ -1042,7 +1042,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi /* signal that we can accept more connections */ if (fds->nfds <= max_queue) pthread_cond_signal(&acceptdata.cond_nfds); - new_sd = fds_poll_recv(fds, -1, 1); + new_sd = fds_poll_recv(fds, selfchk ? selfchk : -1, 1); if (!fds->nfds) { /* at least the dummy/sync pipe should have remained */ @@ -1205,7 +1205,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi /* SelfCheck */ if(selfchk) { time(¤t_time); - if((current_time - start_time) > (time_t)selfchk) { + if((current_time - start_time) >= (time_t)selfchk) { if(reload_db(engine, dboptions, opts, TRUE, &ret)) { pthread_mutex_lock(&reload_mutex); reload = 1;