Checking in the g2r-basis-filename patch that ensures that the receiver
[rsync/rsync.git] / io.c
diff --git a/io.c b/io.c
index 029f74b..50eca53 100644 (file)
--- a/io.c
+++ b/io.c
@@ -857,6 +857,11 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
                        if (msg_fd_in > maxfd)
                                maxfd = msg_fd_in;
                }
+               if (fd != sock_f_out && iobuf_out_cnt && no_flush == 1) {
+                       FD_SET(sock_f_out, &w_fds);
+                       if (sock_f_out > maxfd)
+                               maxfd = sock_f_out;
+               }
 
                tv.tv_sec = select_timeout;
                tv.tv_usec = 0;
@@ -875,8 +880,14 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
                if (msg_fd_in >= 0 && FD_ISSET(msg_fd_in, &r_fds))
                        read_msg_fd();
 
-               if (!FD_ISSET(fd, &w_fds))
+               if (!FD_ISSET(fd, &w_fds)) {
+                       if (fd != sock_f_out && iobuf_out_cnt) {
+                               no_flush--;
+                               io_flush(NORMAL_FLUSH);
+                               no_flush++;
+                       }
                        continue;
+               }
 
                n = len - total;
                if (bwlimit && n > bwlimit_writemax)