Quoting from Pavel Brenev's mail on Wed, Jun 11, 2003 at 11:24:05AM +0400:
rfunk(_at_)funknet(_dot_)net wrote:
fetchmail: SMTP> MAIL FROM:<mobtelefon(_at_)aol(_dot_)com> BODY=7BIT
SIZE=5456
fetchmail: SMTP< 421 Error: timeout exceeded
fetchmail: SMTP error: 421 Error: timeout exceeded
fetchmail: SIGPIPE thrown from an MDA or a stream socket error
fetchmail: socket error while fetching from mail.home.ru
fetchmail: 6.2.2 querying mail.home.ru (protocol POP3) at ??? 10 ???
2003 12:03:47: poll completed
fetchmail: Query status=2 (SOCKET)
fetchmail: sleeping at ??? 10 ??? 2003 12:03:47
Please try this patch. It resets the connection to smtp server if the
timeout has been exceeded. I have tested it by setting a very low
timeout.
===================================================================
diff -Naur fetchmail-6.2.2.orig/sink.c fetchmail-6.2.2/sink.c
--- fetchmail-6.2.2.orig/sink.c 2003-06-11 13:35:38.000000000 +0530
+++ fetchmail-6.2.2/sink.c 2003-06-11 14:30:30.000000000 +0530
@@ -73,6 +73,11 @@
char *parsed_host = NULL;
/* maybe it's time to close the socket in order to force delivery */
+ if (last_smtp_ok > 0 && time((time_t *)NULL) - last_smtp_ok > mytimeout)
+ {
+ smtp_close(ctl, 1);
+ last_smtp_ok = 0;
+ }
if (NUM_NONZERO(ctl->batchlimit)) {
if (batchcount == ctl->batchlimit)
smtp_close(ctl, 1);
diff -Naur fetchmail-6.2.2.orig/smtp.c fetchmail-6.2.2/smtp.c
--- fetchmail-6.2.2.orig/smtp.c 2003-06-11 13:35:38.000000000 +0530
+++ fetchmail-6.2.2/smtp.c 2003-06-11 14:30:30.000000000 +0530
@@ -327,6 +327,8 @@
return ok;
}
+time_t last_smtp_ok = 0;
+
int SMTP_ok(int sock)
/* returns status of SMTP connection */
{
@@ -360,6 +362,8 @@
return SM_UNRECOVERABLE;
}
+ last_smtp_ok = time((time_t *) NULL);
+
if ((smtp_response[0] == '1' || smtp_response[0] == '2' ||
smtp_response[0] == '3') &&
smtp_response[3] == ' ')
return SM_OK;
diff -Naur fetchmail-6.2.2.orig/smtp.h fetchmail-6.2.2/smtp.h
--- fetchmail-6.2.2.orig/smtp.h 2002-03-11 00:59:31.000000000 +0530
+++ fetchmail-6.2.2/smtp.h 2003-06-11 14:31:30.000000000 +0530
@@ -7,6 +7,8 @@
#ifndef _POPSMTP_
#define _POPSMTP_
+#include <time.h>
+
#define SMTPBUFSIZE 256
/* SMTP error values */
@@ -21,6 +23,8 @@
#define ESMTP_ATRN 0x08 /* used with ODMR, RFC 2645 */
#define ESMTP_AUTH 0x10
+extern time_t last_smtp_ok;
+
void SMTP_setmode(char);
int SMTP_helo(int socket,const char *host);
int SMTP_ehlo(int socket,const char *host, char *name, char *passwd, int *opt);
===================================================================
--
Sunil Shetye.