diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-01-23 04:59:12 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-01-23 04:59:12 +0000 |
commit | b31878f4785dcc0ee2b346bb4e0b501aac4dc847 (patch) | |
tree | 8d81bb21d3fd453d94054c02f99079558322a0ca | |
parent | c4864c2ee620fb6ab7c62151cbb181285a91efd3 (diff) | |
download | fetchmail-b31878f4785dcc0ee2b346bb4e0b501aac4dc847.tar.gz fetchmail-b31878f4785dcc0ee2b346bb4e0b501aac4dc847.tar.bz2 fetchmail-b31878f4785dcc0ee2b346bb4e0b501aac4dc847.zip |
Better error messages.
svn path=/trunk/; revision=1605
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | driver.c | 39 |
2 files changed, 37 insertions, 5 deletions
@@ -16,7 +16,7 @@ Release Notes: ------------------------------------------------------------------------------ -fetchmail-4.4.0 () +fetchmail-4.3.6 () * Improved RPM packaging with correct grouping and an icon. * Fixed another minor bug in handling of `expunge 0'. * Kent Robotti sent a new version of fetchsetup. @@ -34,6 +34,7 @@ fetchmail-4.4.0 () * Close pipe to MDA when we get a nonresponse timeout. This should prevent MDA zombies from piling up when we have errors. * Treat Netscape's "X-Mozilla-Status" lines like "Status:" lines. +* More informative error messages on timeout. There are 269 people on fetchmail-friends and 123 on fetchmail-announce. @@ -92,6 +92,12 @@ static char *shroud; /* string to shroud in debug output, if non-NULL */ static int mytimeout; /* value of nonreponse timeout */ static int msglen; /* actual message length */ +/* use these to track what was happening when the nonresponse timer fired */ +#define GENERAL_WAIT 0 +#define SERVER_WAIT 1 +#define FORWARDING_WAIT 2 +static phase; + static void set_timeout(int timeleft) /* reset the nonresponse-timeout */ { @@ -476,7 +482,7 @@ static int sizeticker; static int stuffline(struct query *ctl, char *buf) /* ship a line to the given control block's output sink (SMTP server or MDA) */ { - int n; + int n, oldphase; char *last; /* The line may contain NUL characters. Find the last char to use @@ -497,6 +503,9 @@ static int stuffline(struct query *ctl, char *buf) } } + oldphase = phase; + phase = FORWARDING_WAIT; + /* * SMTP byte-stuffing. We only do this if the protocol does *not* * use .<CR><LF> as EOM. If it does, the server will already have @@ -536,6 +545,8 @@ static int stuffline(struct query *ctl, char *buf) else if (ctl->smtp_socket != -1) n = SockWrite(ctl->smtp_socket, buf, last - buf); + phase = oldphase; + return(n); } @@ -1503,9 +1514,18 @@ const struct method *proto; /* protocol method table */ if ((js = setjmp(restart)) == 1) { - error(0, 0, - "timeout after %d seconds waiting for %s.", - ctl->server.timeout, ctl->server.pollname); + if (phase == SERVER_WAIT) + error(0, 0, + "timeout after %d seconds waiting for server %s.", + ctl->server.timeout, ctl->server.pollname); + else if (phase == FORWARDING_WAIT) + error(0, 0, + "timeout after %d seconds waiting for %s.", + ctl->server.timeout, + ctl->mda ? "MDA" : "SMTP"); + else + error(0, 0, "timeout after %d seconds.", ctl->server.timeout); + if (ctl->smtp_socket != -1) close(ctl->smtp_socket); if (sock != -1) @@ -2105,8 +2125,14 @@ int sock; /* socket to which server is connected */ char *buf; /* buffer to receive input */ int size; /* length of buffer */ { + int oldphase = phase; /* we don't have to be re-entrant */ + + phase = SERVER_WAIT; if (SockRead(sock, buf, size) == -1) + { + phase = oldphase; return(PS_SOCKET); + } else { if (buf[strlen(buf)-1] == '\n') @@ -2115,6 +2141,7 @@ int size; /* length of buffer */ buf[strlen(buf)-1] = '\r'; if (outlevel == O_VERBOSE) error(0, 0, "%s< %s", protocol->name, buf); + phase = oldphase; return(PS_SUCCESS); } } @@ -2133,6 +2160,9 @@ va_dcl int ok; char buf [POPBUFSIZE+1]; va_list ap; + int oldphase = phase; /* we don't have to be re-entrant */ + + phase = SERVER_WAIT; if (protocol->tagged) (void) sprintf(buf, "%s ", GENSYM); @@ -2176,6 +2206,7 @@ va_dcl ok = (protocol->parse_response)(sock, buf); set_timeout(mytimeout); + phase = oldphase; return(ok); } |