If we fail writing to the socket and we're receiving error messages
authorWayne Davison <wayned@samba.org>
Thu, 29 Jul 2004 07:09:46 +0000 (07:09 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 29 Jul 2004 07:09:46 +0000 (07:09 +0000)
from the other side via a multiplexed input, read the socket to see
if we get some errors that would explain why they went away.

io.c

diff --git a/io.c b/io.c
index bd1ce1ecabff4e65fd284a0204a5afeddaac30a6..f3ea2a692589baddd801d7e16d8f05396033db38 100644 (file)
--- a/io.c
+++ b/io.c
@@ -899,6 +899,13 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
                        rsyserr(FERROR, errno,
                                "writefd_unbuffered failed to write %ld bytes: phase \"%s\"",
                                (long)len, io_write_phase);
+                       /* If the other side is sending us error messages, try
+                        * to grab any messages they sent before they died. */
+                       while (fd == sock_f_out && am_sender) {
+                               io_timeout = 30;
+                               readfd_unbuffered(sock_f_in, io_filesfrom_buf,
+                                                 sizeof io_filesfrom_buf);
+                       }
                        exit_cleanup(RERR_STREAMIO);
                }