Browse code

Better load balancing

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@731 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/08/07 22:12:01
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sat Aug  7 14:10:57 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Better load balancing when max-children is not set
4
+
1 5
 Sat Aug  7 01:33:14 CEST 2004 (tk)
2 6
 ----------------------------------
3 7
   * libclamav: matcher-bm: fix node sorting (false negative example provided
... ...
@@ -24,7 +28,7 @@ Thu Aug  5 11:41:00 CEST 2004 (tk)
24 24
 Thu Aug  5 08:44:51 BST 2004 (njh)
25 25
 ----------------------------------
26 26
   * clamav-milter:	Handle more variants of gethostbyname_r
27
-  			Try harder to get fully qualified hostname
27
+			Try harder to get fully qualified hostname
28 28
 			Template files can now contain more than one variable
29 29
 			Template files sendmail variables handling changed to
30 30
 				allow access to variables not in braces. All
... ...
@@ -96,7 +100,7 @@ Mon Aug  2 12:28:31 CEST 2004 (tk)
96 96
 Sun Aug  1 09:21:50 BST 2004 (njh)
97 97
 ----------------------------------
98 98
   * libclamav/blob.c:	Ensure attachments with pathnames are scanned under
99
-  				Cygwin
99
+				Cygwin
100 100
 
101 101
 Fri Jul 30 21:08:29 CEST 2004 (tk)
102 102
 ----------------------------------
... ...
@@ -464,6 +464,7 @@ Changes
464 464
 0.75g	06/8/04	Handle privdata->from not set when --bounce is set
465 465
 			"Denis Ustimenko" <den@uzsci.net>
466 466
 		Quarantined file's names now contain the name of the virus
467
+0.75h	07/8/04	Some tweaking of the load balancing code
467 468
 
468 469
 BUG REPORTS
469 470
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.116  2004/08/07 13:10:33  nigelhorne
30
+ * Better load balancing
31
+ *
29 32
  * Revision 1.115  2004/08/06 10:08:31  nigelhorne
30 33
  * Quarantined files now include the virus in the name
31 34
  *
... ...
@@ -356,9 +359,9 @@
356 356
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
357 357
  * Added -f flag use MaxThreads if --max-children not set
358 358
  */
359
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.115 2004/08/06 10:08:31 nigelhorne Exp $";
359
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.116 2004/08/07 13:10:33 nigelhorne Exp $";
360 360
 
361
-#define	CM_VERSION	"0.75g"
361
+#define	CM_VERSION	"0.75h"
362 362
 
363 363
 /*#define	CONFDIR	"/usr/local/etc"*/
364 364
 
... ...
@@ -1397,7 +1400,12 @@ findServer(void)
1397 1397
 	if(max_children > 0)
1398 1398
 		j = n_children - 1;	/* Don't worry about no lock */
1399 1399
 	else
1400
-		j = cli_rndnum(numServers) - 1;
1400
+		/*
1401
+		 * cli_rndnum returns 0..(max-1) - the max argument is not
1402
+		 * the maximum number you want it to return, it is in fact
1403
+		 * one *more* than the maximum number you want it to return
1404
+		 */
1405
+		j = cli_rndnum(numServers);
1401 1406
 
1402 1407
 	for(i = 0, server = servers; i < numServers; i++, server++) {
1403 1408
 		int sock;