Call the new close_multiplexing_in() function in the generator.
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index 715af86..0c35536 100644 (file)
--- a/main.c
+++ b/main.c
@@ -151,6 +151,8 @@ static void report(int f)
        /* this is the client */
 
        if (!am_sender) {
+               /* Read the first two in opposite order because the meaning of
+                * read/write swaps when switching from sender to receiver. */
                total_written = read_longint(f);
                total_read = read_longint(f);
                stats.total_size = read_longint(f);
@@ -461,9 +463,8 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
 
        if (!delete_after) {
                /* I moved this here from recv_files() to prevent a race condition */
-               if (recurse && delete_mode && !local_name && flist->count>0) {
+               if (recurse && delete_mode && !local_name && flist->count > 0)
                        delete_files(flist);
-               }
        }
 
        if (fd_pair(error_pipe) < 0) {
@@ -479,7 +480,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
                        close(f_out);
 
                /* we can't let two processes write to the socket at one time */
-               io_multiplexing_close();
+               close_multiplexing_out();
 
                /* set place to send errors */
                set_msg_fd_out(error_pipe[1]);
@@ -498,6 +499,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
        }
 
        am_generator = 1;
+       close_multiplexing_in();
        if (write_batch)
                stop_write_batch();
 
@@ -1085,6 +1087,8 @@ int main(int argc,char *argv[])
                                batch_name);
                        exit_cleanup(RERR_FILEIO);
                }
+               if (read_batch)
+                       read_stream_flags(batch_fd);
        }
 
        if (am_daemon && !am_server)