fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]repolling for imap...

2002-01-28 01:42:48
Quoting from Sunil Shetye's mail on Mon, Jan 28, 2002 at 12:21:37PM +0530:
fetchmail does not sometimes send a quit before closing connection.
This happens when batchlimit is reached and when idling for mail.

The batchcount seems to be off by one for the first batch.

e.g., if it is set to 10, it sends 9, 10, 10, 10, 10, .... mails to
smtp server.

This patch should fix that:

==============================================================================
diff -Naur fetchmail-5.9.6.orig/sink.c fetchmail-5.9.6/sink.c
--- fetchmail-5.9.6.orig/sink.c Mon Jan 28 12:37:54 2002
+++ fetchmail-5.9.6/sink.c      Mon Jan 28 12:40:35 2002
@@ -65,8 +65,11 @@
     char *parsed_host = NULL;
 
     /* maybe it's time to close the socket in order to force delivery */
-    if (NUM_NONZERO(ctl->batchlimit) && ++batchcount == ctl->batchlimit)
-       smtp_close(ctl, 1);
+    if (NUM_NONZERO(ctl->batchlimit)) {
+       if (batchcount == ctl->batchlimit)
+           smtp_close(ctl, 1);
+       batchcount++;
+    }
 
     /* if no socket to any SMTP host is already set up, try to open one */
     if (ctl->smtp_socket == -1) 
==============================================================================


<Prev in Thread] Current Thread [Next in Thread>