extern int am_server;
extern int am_sender;
-extern int am_daemon;
-extern int io_timeout;
extern int local_server;
extern int inplace;
extern int recurse;
#define CF_INC_RECURSE (1<<0)
#define CF_SYMLINK_TIMES (1<<1)
#define CF_SYMLINK_ICONV (1<<2)
-#define CF_TIMEOUT_ACTIVE (1<<3)
static const char *client_info;
#ifdef ICONV_OPTION
compat_flags |= CF_SYMLINK_ICONV;
#endif
- if (am_daemon && io_timeout && protocol_version >= 31)
- compat_flags |= CF_TIMEOUT_ACTIVE;
write_byte(f_out, compat_flags);
- if (compat_flags & CF_TIMEOUT_ACTIVE)
- write_varint(f_out, io_timeout);
} else {
compat_flags = read_byte(f_in);
- if (compat_flags & CF_TIMEOUT_ACTIVE) {
- int timeout = read_varint(f_in);
- if (!io_timeout || io_timeout > timeout) {
- if (INFO_GTE(MISC, 2))
- rprintf(FINFO, "Setting --timeout=%d to match server\n", timeout);
- io_timeout = timeout;
- }
- }
}
/* The inc_recurse var MUST be set to 0 or 1. */
inc_recurse = compat_flags & CF_INC_RECURSE ? 1 : 0;
static void read_a_msg(void)
{
char *data, line[BIGPATHBUFLEN];
- int tag;
+ int tag, val;
size_t msg_bytes;
data = perform_io(4, PIO_INPUT_AND_CONSUME);
if (!am_generator)
send_msg(MSG_IO_ERROR, data, 4, 0);
break;
+ case MSG_IO_TIMEOUT:
+ if (msg_bytes != 4 || am_sender || am_generator)
+ goto invalid_msg;
+ data = perform_io(4, PIO_INPUT_AND_CONSUME);
+ val = IVAL(data, 0);
+ if (!io_timeout || io_timeout > val) {
+ if (INFO_GTE(MISC, 2))
+ rprintf(FINFO, "Setting --timeout=%d to match server\n", val);
+ io_timeout = val;
+ }
+ break;
case MSG_NOOP:
if (am_sender)
maybe_send_keepalive();
extern int dry_run;
extern int list_only;
+extern int io_timeout;
extern int am_root;
extern int am_server;
extern int am_sender;
if (protocol_version >= 23)
io_start_multiplex_out(f_out);
+ if (am_daemon && io_timeout && protocol_version >= 31)
+ send_msg_int(MSG_IO_TIMEOUT, io_timeout);
if (am_sender) {
keep_dirlinks = 0; /* Must be disabled on the sender. */
/* This is used when working on a new protocol version in CVS, and should
* be a new non-zero value for each CVS change that affects the protocol.
* It must ALWAYS be 0 when the protocol goes final (and NEVER before)! */
-#define SUBPROTOCOL_VERSION 9
+#define SUBPROTOCOL_VERSION 10
/* We refuse to interoperate with versions that are not in this range.
* Note that we assume we'll work with later versions: the onus is on
MSG_REDO=9, /* reprocess indicated flist index */
MSG_STATS=10, /* message has stats data for generator */
MSG_IO_ERROR=22,/* the sending side had an I/O error */
+ MSG_IO_TIMEOUT=33,/* tell client about a daemon's timeout value */
MSG_NOOP=42, /* a do-nothing message */
MSG_SUCCESS=100,/* successfully updated indicated flist index */
MSG_DELETED=101,/* successfully deleted a file on receiving side */