git-svn: trunk@3116
Nigel Horne authored on 2007/06/26 16:16:14... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Tue Jun 26 07:51:36 BST 2007 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: Improve yesterday's fix to ensure that servers are marked |
|
4 |
+ as down quicker |
|
5 |
+ |
|
1 | 6 |
Mon Jun 25 11:00:32 BST 2007 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* clamav-milter: Don't PING servers that are down so often |
... | ... |
@@ -33,7 +33,7 @@ |
33 | 33 |
*/ |
34 | 34 |
static char const rcsid[] = "$Id: clamav-milter.c,v 1.312 2007/02/12 22:24:21 njh Exp $"; |
35 | 35 |
|
36 |
-#define CM_VERSION "devel-070625" |
|
36 |
+#define CM_VERSION "devel-070626" |
|
37 | 37 |
|
38 | 38 |
#if HAVE_CONFIG_H |
39 | 39 |
#include "clamav-config.h" |
... | ... |
@@ -484,7 +484,7 @@ static long *serverIPs; /* IPv4 only, in network byte order */ |
484 | 484 |
static int numServers; /* number of elements in serverIPs array */ |
485 | 485 |
#ifndef SESSION |
486 | 486 |
#define RETRY_SECS 300 /* How often to retry a server that's down */ |
487 |
-static time_t *last_failed_pings; /* For servers that are down */ |
|
487 |
+static time_t *last_failed_pings; /* For servers that are down. NB: not mutexed */ |
|
488 | 488 |
#endif |
489 | 489 |
|
490 | 490 |
#ifdef CL_EXPERIMENTAL |
... | ... |
@@ -2497,9 +2497,10 @@ try_server(void *var) |
2497 | 2497 |
logg("*try_server: sock %d\n", sock); |
2498 | 2498 |
|
2499 | 2499 |
if((connect(sock, server, sizeof(struct sockaddr)) < 0) || |
2500 |
- (send(sock, "PING\n", 5, 0) < 5)) |
|
2500 |
+ (send(sock, "PING\n", 5, 0) < 5)) { |
|
2501 |
+ time(&last_failed_pings[server_index]); |
|
2501 | 2502 |
s->rc = 0; |
2502 |
- else |
|
2503 |
+ } else |
|
2503 | 2504 |
s->rc = 1; |
2504 | 2505 |
|
2505 | 2506 |
if(s->rc == 0) { |
... | ... |
@@ -2518,7 +2519,6 @@ try_server(void *var) |
2518 | 2518 |
free(hostname); |
2519 | 2519 |
#endif |
2520 | 2520 |
broadcast(_("Check clamd server - it may be down\n")); |
2521 |
- time(&last_failed_pings[server_index]); |
|
2522 | 2521 |
} |
2523 | 2522 |
|
2524 | 2523 |
return var; |
... | ... |
@@ -2585,7 +2585,6 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
2585 | 2585 |
logg(_("clamfi_connect: Unexpected sa_family %d\n"), |
2586 | 2586 |
hostaddr->sa_family); |
2587 | 2587 |
return cl_error; |
2588 |
- break; |
|
2589 | 2588 |
} |
2590 | 2589 |
|
2591 | 2590 |
#else |