while ((waited_pid = waitpid(pid, status, WNOHANG)) == 0) {
msleep(20);
- io_flush();
+ io_flush(FULL_FLUSH);
}
if ((waited_pid == -1) && (errno == ECHILD)) {
mi = mallinfo();
- rprintf(FINFO, RSYNC_NAME "[%d] (%s%s%s) heap statistics:\n",
+ rprintf(FINFO, "\n" RSYNC_NAME "[%d] (%s%s%s) heap statistics:\n",
getpid(),
am_server ? "server " : "",
am_daemon ? "daemon " : "",
args[argc++] = rsync_path;
if (blocking_io < 0) {
- char *cp = getenv(RSYNC_RSH_IO_ENV);
- if (rsh_env && cp && strcmp(cmd, rsh_env) == 0)
- blocking_io = *cp == 'b' || *cp == 'B';
- else {
- if ((cp = strrchr(cmd, '/')) != NULL)
- cp++;
- else
- cp = cmd;
- if (strcmp(cp, "rsh") == 0 || strcmp(cp, "remsh") == 0)
- blocking_io = 1;
- }
+ char *cp;
+ if ((cp = strrchr(cmd, '/')) != NULL)
+ cp++;
+ else
+ cp = cmd;
+ if (strcmp(cp, "rsh") == 0 || strcmp(cp, "remsh") == 0)
+ blocking_io = 1;
}
server_options(args,&argc);
exit_cleanup(0);
}
+ io_start_buffering_in(f_in);
+ io_start_buffering_out(f_out);
send_files(flist,f_out,f_in);
- io_flush();
+ io_flush(FULL_FLUSH);
report(f_out);
if (protocol_version >= 24) {
/* final goodbye message */
- read_int(f_in);
- }
- io_flush();
+ read_int(f_in);
+ }
+ io_flush(FULL_FLUSH);
exit_cleanup(0);
}
{
int pid;
int status=0;
- int recv_pipe[2];
int error_pipe[2];
extern int preserve_hard_links;
extern int delete_after;
}
}
- if (fd_pair(recv_pipe) < 0) {
- rprintf(FERROR,"pipe failed in do_recv\n");
- exit_cleanup(RERR_SOCKETIO);
- }
-
if (fd_pair(error_pipe) < 0) {
rprintf(FERROR,"error pipe failed in do_recv\n");
exit_cleanup(RERR_SOCKETIO);
}
- io_flush();
+ io_flush(NORMAL_FLUSH);
if ((pid=do_fork()) == 0) {
- close(recv_pipe[0]);
close(error_pipe[0]);
if (f_in != f_out) close(f_out);
io_multiplexing_close();
/* set place to send errors */
- set_error_fd(error_pipe[1]);
+ set_msg_fd_out(error_pipe[1]);
- recv_files(f_in,flist,local_name,recv_pipe[1]);
- io_flush();
+ recv_files(f_in,flist,local_name);
+ io_flush(FULL_FLUSH);
report(f_in);
- write_int(recv_pipe[1],1);
- close(recv_pipe[1]);
- io_flush();
+ send_msg(MSG_DONE, "", 0);
+ io_flush(FULL_FLUSH);
/* finally we go to sleep until our parent kills us
* with a USR2 signal. We sleep for a short time as on
* some OSes a signal won't interrupt a sleep! */
- while (msleep(20))
- ;
+ while (1)
+ msleep(20);
}
- close(recv_pipe[1]);
close(error_pipe[1]);
if (f_in != f_out) close(f_in);
- io_start_buffering(f_out);
+ io_start_buffering_out(f_out);
- io_set_error_fd(error_pipe[0]);
+ set_msg_fd_in(error_pipe[0]);
- generate_files(f_out,flist,local_name,recv_pipe[0]);
+ generate_files(f_out, flist, local_name);
- read_int(recv_pipe[0]);
- close(recv_pipe[0]);
+ get_redo_num(); /* Read final -1, and any prior messages. */
+ io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
/* send a final goodbye message */
write_int(f_out, -1);
}
- io_flush();
+ io_flush(FULL_FLUSH);
- io_set_error_fd(-1);
+ set_msg_fd_in(-1);
kill(pid, SIGUSR2);
wait_process(pid, &status);
return status;
}
}
+ io_start_buffering_in(f_in);
if (delete_mode && !delete_excluded)
recv_exclude_list(f_in);
extern int cvs_exclude;
extern int delete_mode;
extern int delete_excluded;
+ io_start_buffering_out(f_out);
if (cvs_exclude)
add_cvs_excludes();
if (delete_mode && !delete_excluded)
send_exclude_list(f_out);
if (remote_filesfrom_file)
filesfrom_fd = f_in;
- if (!read_batch) /* dw -- don't write to pipe */
+ if (!read_batch) /* don't write to pipe */
flist = send_file_list(f_out,argc,argv);
if (verbose > 3)
rprintf(FINFO,"file list sent\n");
+ io_flush(NORMAL_FLUSH);
+ io_start_buffering_out(f_out);
send_files(flist,f_out,f_in);
+ io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
/* final goodbye message */
read_int(f_in);
if (pid != -1) {
if (verbose > 3)
rprintf(FINFO,"client_run waiting on %d\n", (int) pid);
- io_flush();
+ io_flush(FULL_FLUSH);
wait_process(pid, &status);
}
report(-1);
+ io_flush(FULL_FLUSH);
exit_cleanup(status);
}
if (pid != -1) {
if (verbose > 3)
rprintf(FINFO,"client_run2 waiting on %d\n", (int) pid);
- io_flush();
+ io_flush(FULL_FLUSH);
wait_process(pid, &status);
}