diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-07 08:09:57 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-07 08:09:57 +0000 |
commit | a944bfd1e9c51a2b12be71666f4b7891f9ec3bec (patch) | |
tree | 61d6408f1bcb62b01c917ca5f8c81a511f3e9aa2 /odmr.c | |
parent | 8a111f01e0f0b650a48529f743b67cc9c84e1bbc (diff) | |
download | fetchmail-a944bfd1e9c51a2b12be71666f4b7891f9ec3bec.tar.gz fetchmail-a944bfd1e9c51a2b12be71666f4b7891f9ec3bec.tar.bz2 fetchmail-a944bfd1e9c51a2b12be71666f4b7891f9ec3bec.zip |
Copy loop has monitoring and termination now.
svn path=/trunk/; revision=3030
Diffstat (limited to 'odmr.c')
-rw-r--r-- | odmr.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -125,7 +125,7 @@ static int odmr_getrange(int sock, struct query *ctl, const char *id, * throw their data at each other. */ smtp_sock = SockOpen(ctl->smtphost, SMTP_PORT, NULL, NULL); - if (smtp_sock) + if (smtp_sock == -1) return(PS_SOCKET); else { @@ -150,14 +150,25 @@ static int odmr_getrange(int sock, struct query *ctl, const char *id, if (FD_ISSET(sock, &readfds)) { int n = SockRead(sock, buf, sizeof(buf)); + if (n <= 0) + break; + SockWrite(smtp_sock, buf, n); + if (outlevel >= O_MONITOR) + report(stdout, "ODMR< %s\n", buf); } if (FD_ISSET(smtp_sock, &readfds)) { int n = SockRead(smtp_sock, buf, sizeof(buf)); + if (n <= 0) + break; + SockWrite(sock, buf, n); + if (outlevel >= O_MONITOR) + report(stdout, "ODMR> %s\n", buf); } } + SockClose(smtp_sock); } return(0); |