- Moved the arg-checking relating into set_allow_inc_recurse() and
call it when the server is in setup_protocol(). The function sets allow_inc_recurse to 0 if some options won't allow us to support an incremental-recursive transfer. - The server now checks for an 'i' in the -e option from the client and zeros out allow_inc_recurse if not found. - The server reports its inc_recurse determination back to the client. - The client sets inc_recurse based on the value it gets from the server.
This commit is contained in:
32
compat.c
32
compat.c
@@ -102,6 +102,16 @@ static void check_sub_protocol(void)
|
|||||||
protocol_version--;
|
protocol_version--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_allow_inc_recurse(void)
|
||||||
|
{
|
||||||
|
if (!recurse || delete_before || delete_after || use_qsort
|
||||||
|
|| (!am_sender && (delay_updates || prune_empty_dirs)))
|
||||||
|
allow_inc_recurse = 0;
|
||||||
|
else if (am_server && !local_server
|
||||||
|
&& (!shell_cmd || strchr(shell_cmd, 'i') == NULL))
|
||||||
|
allow_inc_recurse = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void setup_protocol(int f_out,int f_in)
|
void setup_protocol(int f_out,int f_in)
|
||||||
{
|
{
|
||||||
if (am_sender)
|
if (am_sender)
|
||||||
@@ -117,6 +127,9 @@ void setup_protocol(int f_out,int f_in)
|
|||||||
if (preserve_xattrs)
|
if (preserve_xattrs)
|
||||||
xattrs_ndx = ++file_extra_cnt;
|
xattrs_ndx = ++file_extra_cnt;
|
||||||
|
|
||||||
|
if (am_server)
|
||||||
|
set_allow_inc_recurse();
|
||||||
|
|
||||||
if (remote_protocol == 0) {
|
if (remote_protocol == 0) {
|
||||||
if (am_server && !local_server)
|
if (am_server && !local_server)
|
||||||
check_sub_protocol();
|
check_sub_protocol();
|
||||||
@@ -216,21 +229,18 @@ void setup_protocol(int f_out,int f_in)
|
|||||||
exit_cleanup(RERR_PROTOCOL);
|
exit_cleanup(RERR_PROTOCOL);
|
||||||
}
|
}
|
||||||
} else if (protocol_version >= 30) {
|
} else if (protocol_version >= 30) {
|
||||||
if (recurse && allow_inc_recurse
|
if (am_server) {
|
||||||
&& !delete_before && !delete_after && !delay_updates
|
inc_recurse = allow_inc_recurse;
|
||||||
&& !use_qsort && !prune_empty_dirs)
|
write_byte(f_out, inc_recurse);
|
||||||
inc_recurse = 1;
|
} else
|
||||||
if (am_server || read_batch) {
|
inc_recurse = read_byte(f_in);
|
||||||
int i_r = read_byte(f_in);
|
if (inc_recurse && !allow_inc_recurse) {
|
||||||
if (i_r && !inc_recurse) {
|
/* This should only be able to happen in a batch. */
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Incompatible options specified for inc-recursive %s.\n",
|
"Incompatible options specified for inc-recursive %s.\n",
|
||||||
read_batch ? "batch file" : "connection");
|
read_batch ? "batch file" : "protocol");
|
||||||
exit_cleanup(RERR_SYNTAX);
|
exit_cleanup(RERR_SYNTAX);
|
||||||
}
|
}
|
||||||
inc_recurse = i_r;
|
|
||||||
} else
|
|
||||||
write_byte(f_out, inc_recurse);
|
|
||||||
need_messages_from_generator = 1;
|
need_messages_from_generator = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user