From 001ba3be1d72c8d881fc38c1f57286c0a384e8ed Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 17 Oct 1997 14:12:11 +0000 Subject: Only re-poll when we've had actual dispatches. svn path=/trunk/; revision=1521 --- driver.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 6c22a49e..82654676 100644 --- a/driver.c +++ b/driver.c @@ -1467,7 +1467,7 @@ const struct method *proto; /* protocol method table */ { char buf [POPBUFSIZE+1], *realhost; int *msgsizes, len, num, count, new, deletions = 0; - int port, fetches; + int port, fetches, dispatches; struct idlist *idp; /* execute pre-initialization command, if any */ @@ -1555,6 +1555,7 @@ const struct method *proto; /* protocol method table */ for (idp = ctl->mailboxes; idp; idp = idp->next) { do { + dispatches = 0; ++pass; if (outlevel >= O_VERBOSE) @@ -1797,6 +1798,10 @@ const struct method *proto; /* protocol method table */ } } + /* count # messages forwarded on this pass */ + if (!suppress_forward) + dispatches++; + /* * Check to see if the numbers matched? * @@ -1898,15 +1903,20 @@ const struct method *proto; /* protocol method table */ } } while /* - * Only re-poll if we allowed deletions and had no errors. + * Only re-poll if we had some actual forwards, allowed + * deletions and had no errors. * Otherwise it is far too easy to get into infinite loops. */ - (fetches && protocol->retry && !ctl->keep && !ctl->errcount); + (dispatches && protocol->retry && !ctl->keep && !ctl->errcount); } no_error: set_timeout(ctl->server.timeout); ok = (protocol->logout_cmd)(sock, ctl); + /* + * Hmmmm...arguably this would be incorrect if we had fetches but + * no dispatches (due to oversized messages, etc.) + */ if (ok == 0) ok = (fetches > 0) ? PS_SUCCESS : PS_NOMAIL; set_timeout(0); -- cgit v1.2.3