X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/a800434a82af8dbd59da7c27b382c9897dd90150..e1b3d5c4be46ee0b17a98aa48cb7cb152c4a008b:/main.c diff --git a/main.c b/main.c index 6fd96a7c..3c4d99c7 100644 --- a/main.c +++ b/main.c @@ -88,6 +88,9 @@ static void report(int f) printf("total size is %.0f speedup is %.2f\n", (double)stats.total_size, (1.0*stats.total_size)/(stats.total_written+stats.total_read)); + + fflush(stdout); + fflush(stderr); } @@ -247,6 +250,10 @@ static void do_server_sender(int f_in, int f_out, int argc,char *argv[]) exit_cleanup(0); } + set_nonblocking(f_out); + if (f_in != f_out) + set_nonblocking(f_in); + send_files(flist,f_out,f_in); report(f_out); io_flush(); @@ -275,6 +282,8 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name) close(recv_pipe[0]); if (f_in != f_out) close(f_out); + set_nonblocking(f_in); + recv_files(f_in,flist,local_name,recv_pipe[1]); report(f_in); @@ -288,6 +297,9 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name) close(recv_pipe[1]); io_close_input(f_in); if (f_in != f_out) close(f_in); + + set_nonblocking(f_out); + generate_files(f_out,flist,local_name,recv_pipe[0]); io_flush(); @@ -378,6 +390,11 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[]) flist = send_file_list(f_out,argc,argv); if (verbose > 3) rprintf(FINFO,"file list sent\n"); + + set_nonblocking(f_out); + if (f_in != f_out) + set_nonblocking(f_in); + send_files(flist,f_out,f_in); if (pid != -1) { if (verbose > 3) @@ -412,13 +429,13 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[]) } -int start_client(int argc, char *argv[]) +static int start_client(int argc, char *argv[]) { char *p; char *shell_machine = NULL; char *shell_path = NULL; char *shell_user = NULL; - int pid; + int pid, ret; int f_in,f_out; extern int local_server; extern int am_sender; @@ -499,7 +516,12 @@ int start_client(int argc, char *argv[]) setlinebuf(stderr); #endif - return client_run(f_in, f_out, pid, argc, argv); + ret = client_run(f_in, f_out, pid, argc, argv); + + fflush(stdout); + fflush(stderr); + + return ret; }