Quoting from B Wooster's mail on Tue, Jun 17, 2003 at 02:32:28PM +0000:
Applied the driver.c patch, but still fails.
[I did the routine check to make sure driver.c recompiled, and the timestamp
on fetchmail changed, am running the new one, etc, I think build is all
ok...]
Did work the first time I ran fetchmail (but, it used to work
intermittently like
this before too), and then fails each time I ran it subsequently, here are
three sessions:
Ok. Here is a new patch (you will have to undo the previous one). I
have changed the value of PS_IDLETIMEOUT from 15 to 29. So, if you are
still getting the exit status of 15, either you are using an old
fetchmail or the problem is somewhere else. Apart from that, this
patch removes the resetting of idletimeout from settimeout(). Instead,
it is reset explicitly.
Please try this patch:
=====================================================================
diff -Naur fetchmail-6.2.2.orig/driver.c fetchmail-6.2.2/driver.c
--- fetchmail-6.2.2.orig/driver.c 2003-06-11 14:35:39.000000000 +0530
+++ fetchmail-6.2.2/driver.c 2003-06-18 12:03:54.000000000 +0530
@@ -69,8 +69,8 @@
flag peek_capable; /* can we peek for better error recovery? */
int mailserver_socket_temp = -1; /* socket to free if connect timeout */
-static int timeoutcount; /* count consecutive timeouts */
-static int idletimeout; /* timeout occured in idle
stage? */
+volatile static int timeoutcount = 0; /* count consecutive timeouts */
+volatile static int idletimeout = 0; /* timeout occured in idle stage? */
static jmp_buf restart;
@@ -80,6 +80,11 @@
return idletimeout;
}
+void resetidletimeout(void)
+{
+ idletimeout = 0;
+}
+
void set_timeout(int timeleft)
/* reset the nonresponse-timeout */
{
@@ -89,8 +94,6 @@
if (timeleft == 0)
timeoutcount = 0;
- idletimeout = 1;
-
ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0;
ntimeout.it_value.tv_sec = timeleft;
ntimeout.it_value.tv_usec = 0;
diff -Naur fetchmail-6.2.2.orig/fetchmail.h fetchmail-6.2.2/fetchmail.h
--- fetchmail-6.2.2.orig/fetchmail.h 2003-06-11 14:35:39.000000000 +0530
+++ fetchmail-6.2.2/fetchmail.h 2003-06-18 12:05:09.000000000 +0530
@@ -94,7 +94,6 @@
#define PS_BSMTP 12 /* output batch could not be
opened */
#define PS_MAXFETCH 13 /* poll ended by fetch limit */
#define PS_SERVBUSY 14 /* server is busy */
-#define PS_IDLETIMEOUT 15 /* timeout on imap IDLE */
/* leave space for more codes */
#define PS_UNDEFINED 23 /* something I hadn't thought
of */
#define PS_TRANSIENT 24 /* transient failure (internal
use) */
@@ -102,6 +101,7 @@
#define PS_RETAINED 26 /* message retained (internal
use) */
#define PS_TRUNCATED 27 /* headers incomplete (internal
use) */
#define PS_REPOLL 28 /* repoll immediately with
changed parameters (internal use) */
+#define PS_IDLETIMEOUT 29 /* timeout on imap IDLE
(internal use) */
/* output noise level */
#define O_SILENT 0 /* mute, max squelch, etc. */
@@ -429,6 +429,7 @@
/* driver.c -- main driver loop */
void set_timeout(int);
int isidletimeout(void);
+void resetidletimeout(void);
int do_protocol(struct query *, const struct method *);
/* transact.c: transaction support */
diff -Naur fetchmail-6.2.2.orig/transact.c fetchmail-6.2.2/transact.c
--- fetchmail-6.2.2.orig/transact.c 2003-06-11 14:35:39.000000000 +0530
+++ fetchmail-6.2.2/transact.c 2003-06-18 12:05:44.000000000 +0530
@@ -1453,7 +1453,10 @@
set_timeout(0);
phase = oldphase;
if(isidletimeout())
+ {
+ resetidletimeout();
return(PS_IDLETIMEOUT);
+ }
else
return(PS_SOCKET);
}
=====================================================================
--
Sunil Shetye.