aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-04 05:58:19 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-04 05:58:19 +0000
commitfd84b71d13951d2e72dc165f9f8736097e3ba4c2 (patch)
tree9b4bf8ca054567f75dc36363b195549b232d7eab /fetchmail.c
parent524a6e71a397f24e39afb42aa87c18277e6eddb0 (diff)
downloadfetchmail-fd84b71d13951d2e72dc165f9f8736097e3ba4c2.tar.gz
fetchmail-fd84b71d13951d2e72dc165f9f8736097e3ba4c2.tar.bz2
fetchmail-fd84b71d13951d2e72dc165f9f8736097e3ba4c2.zip
Close SMTP sockets after each poll cycle to avoid MTA timeouts.
svn path=/trunk/; revision=472
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fetchmail.c b/fetchmail.c
index b731b2a7..5bbe37f8 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -308,6 +308,21 @@ char **argv;
endhostent(); /* release TCP/IP connection to nameserver */
#endif /* HAVE_GETHOSTBYNAME */
+ /*
+ * Close all SMTP delivery sockets. For optimum performance
+ * we'd like to hold them open til end of run, but (1) this
+ * loses if our poll interval is longer than the MTA's inactivity
+ * timeout, and (2) some MTAs (like smail) don't deliver after
+ * each message, but rather queue up mail and wait to actually
+ * deliver it until the input socket is closed.
+ */
+ for (ctl = querylist; ctl; ctl = ctl->next)
+ if (ctl->smtp_sockfp)
+ {
+ fclose(ctl->smtp_sockfp);
+ ctl->smtp_sockfp = (FILE *)NULL;
+ }
+
if (poll_interval)
{
if (outlevel == O_VERBOSE)