aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-02-07 08:09:57 +0000
committerEric S. Raymond <esr@thyrsus.com>2001-02-07 08:09:57 +0000
commita944bfd1e9c51a2b12be71666f4b7891f9ec3bec (patch)
tree61d6408f1bcb62b01c917ca5f8c81a511f3e9aa2
parent8a111f01e0f0b650a48529f743b67cc9c84e1bbc (diff)
downloadfetchmail-a944bfd1e9c51a2b12be71666f4b7891f9ec3bec.tar.gz
fetchmail-a944bfd1e9c51a2b12be71666f4b7891f9ec3bec.tar.bz2
fetchmail-a944bfd1e9c51a2b12be71666f4b7891f9ec3bec.zip
Copy loop has monitoring and termination now.
svn path=/trunk/; revision=3030
-rw-r--r--odmr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/odmr.c b/odmr.c
index d0623c0f..95da2469 100644
--- a/odmr.c
+++ b/odmr.c
@@ -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);