Browse code

wake recvloopth after SelfCheck (if set), to avoid reloading the DB just before next scan request.

git-svn: trunk@4904

Török Edvin authored on 2009/03/06 21:21:58
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Mar  6 14:21:52 EET 2009 (edwin)
2
+------------------------------------
3
+ * clamd/others.c, clamd/server-th.c: wake recvloopth after SelfCheck
4
+ (if set), to avoid reloading the DB just before next scan request.
5
+
1 6
 Fri Mar  6 11:19:32 EET 2009 (edwin)
2 7
 ------------------------------------
3 8
  * clamav-milter/Makefile.am, clamav-milter/Makefile.in: fix make
... ...
@@ -454,7 +454,7 @@ int fds_poll_recv(struct fd_data *data, int timeout, int check_signals)
454 454
 	} else {
455 455
 	    if (!closest_timeout)
456 456
 		closest_timeout = timeout_at;
457
-	    else if (timeout_at < closest_timeout)
457
+	    else if (timeout_at && timeout_at < closest_timeout)
458 458
 		closest_timeout = timeout_at;
459 459
 	}
460 460
     }
... ...
@@ -1042,7 +1042,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
1042 1042
 	/* signal that we can accept more connections */
1043 1043
 	if (fds->nfds <= max_queue)
1044 1044
 	    pthread_cond_signal(&acceptdata.cond_nfds);
1045
-	new_sd = fds_poll_recv(fds, -1, 1);
1045
+	new_sd = fds_poll_recv(fds, selfchk ? selfchk : -1, 1);
1046 1046
 
1047 1047
 	if (!fds->nfds) {
1048 1048
 	    /* 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
1205 1205
 	/* SelfCheck */
1206 1206
 	if(selfchk) {
1207 1207
 	    time(&current_time);
1208
-	    if((current_time - start_time) > (time_t)selfchk) {
1208
+	    if((current_time - start_time) >= (time_t)selfchk) {
1209 1209
 		if(reload_db(engine, dboptions, opts, TRUE, &ret)) {
1210 1210
 		    pthread_mutex_lock(&reload_mutex);
1211 1211
 		    reload = 1;