mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-21 05:14:15 -04:00
Don't send MSG_ERROR_EXIT messages at the end of the transfer.
Added some debug output for MSG_ERROR_EXIT messages.
This commit is contained in:
1 parent
24079e988f
commit
0c2e8f9364
4 files changed
+35
-9
No files matched your search
@@ -34,6 +34,8 @@ extern int output_needs_newline;
|
||||
extern char *partial_dir;
|
||||
extern char *logfile_name;
|
||||
|
||||
BOOL shutting_down = False;
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
static struct sigaction sigact;
|
||||
#endif
|
||||
@@ -132,8 +134,8 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
|
||||
|
||||
if (DEBUG_GTE(EXIT, 2)) {
|
||||
rprintf(FINFO,
|
||||
"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
|
||||
code, file, line);
|
||||
"[%s] _exit_cleanup(code=%d, file=%s, line=%d): entered\n",
|
||||
who_am_i(), code, file, line);
|
||||
}
|
||||
|
||||
/* FALLTHROUGH */
|
||||
@@ -205,18 +207,23 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
|
||||
|
||||
if (DEBUG_GTE(EXIT, 1)) {
|
||||
rprintf(FINFO,
|
||||
"_exit_cleanup(code=%d, file=%s, line=%d): "
|
||||
"[%s] _exit_cleanup(code=%d, file=%s, line=%d): "
|
||||
"about to call exit(%d)\n",
|
||||
unmodified_code, file, line, code);
|
||||
who_am_i(), unmodified_code, file, line, code);
|
||||
}
|
||||
|
||||
/* FALLTHROUGH */
|
||||
#include "case_N.h"
|
||||
|
||||
if (exit_code && exit_code != RERR_SOCKETIO && exit_code != RERR_STREAMIO && exit_code != RERR_SIGNAL1
|
||||
&& (protocol_version >= 31 || (!am_sender && !am_generator))) {
|
||||
if (line > 0)
|
||||
&& !shutting_down && (protocol_version >= 31 || (!am_sender && !am_generator))) {
|
||||
if (line > 0) {
|
||||
if (DEBUG_GTE(EXIT, 3)) {
|
||||
rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT with exit_code %d\n",
|
||||
who_am_i(), exit_code);
|
||||
}
|
||||
send_msg_int(MSG_ERROR_EXIT, exit_code);
|
||||
}
|
||||
noop_io_until_death();
|
||||
}
|
||||
|
||||
|
||||
@@ -1489,8 +1489,14 @@ static void read_a_msg(void)
|
||||
}
|
||||
break;
|
||||
case MSG_ERROR_EXIT:
|
||||
if (DEBUG_GTE(EXIT, 3))
|
||||
rprintf(FINFO, "[%s] got MSG_ERROR_EXIT with %d bytes\n", who_am_i(), msg_bytes);
|
||||
if (msg_bytes == 0) {
|
||||
if (!am_sender && !am_generator) {
|
||||
if (DEBUG_GTE(EXIT, 3)) {
|
||||
rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT (len 0)\n",
|
||||
who_am_i());
|
||||
}
|
||||
send_msg(MSG_ERROR_EXIT, "", 0, 0);
|
||||
io_flush(FULL_FLUSH);
|
||||
}
|
||||
@@ -1499,10 +1505,19 @@ static void read_a_msg(void)
|
||||
data = perform_io(4, PIO_INPUT_AND_CONSUME);
|
||||
val = IVAL(data, 0);
|
||||
if (protocol_version >= 31) {
|
||||
if (am_generator)
|
||||
if (am_generator) {
|
||||
if (DEBUG_GTE(EXIT, 3)) {
|
||||
rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT with exit_code %d\n",
|
||||
who_am_i(), val);
|
||||
}
|
||||
send_msg_int(MSG_ERROR_EXIT, val);
|
||||
else
|
||||
} else {
|
||||
if (DEBUG_GTE(EXIT, 3)) {
|
||||
rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT (len 0)\n",
|
||||
who_am_i());
|
||||
}
|
||||
send_msg(MSG_ERROR_EXIT, "", 0, 0);
|
||||
}
|
||||
}
|
||||
} else
|
||||
goto invalid_msg;
|
||||
|
||||
@@ -73,6 +73,7 @@ extern int send_msgs_to_gen;
|
||||
extern pid_t cleanup_child_pid;
|
||||
extern size_t bwlimit_writemax;
|
||||
extern unsigned int module_dirlen;
|
||||
extern BOOL shutting_down;
|
||||
extern struct stats stats;
|
||||
extern char *stdout_format;
|
||||
extern char *logfile_format;
|
||||
@@ -726,6 +727,8 @@ static void read_final_goodbye(int f_in, int f_out)
|
||||
uchar fnamecmp_type;
|
||||
char xname[MAXPATHLEN];
|
||||
|
||||
shutting_down = True;
|
||||
|
||||
if (protocol_version < 29)
|
||||
i = read_int(f_in);
|
||||
else {
|
||||
@@ -921,6 +924,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
|
||||
|
||||
handle_stats(-1);
|
||||
io_flush(FULL_FLUSH);
|
||||
shutting_down = True;
|
||||
if (protocol_version >= 24) {
|
||||
/* send a final goodbye message */
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
|
||||
@@ -271,7 +271,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
|
||||
DEBUG_WORD(DEL, W_REC, "Debug delete actions (levels 1-3)"),
|
||||
DEBUG_WORD(DELTASUM, W_SND|W_REC, "Debug delta-transfer checksumming (levels 1-4)"),
|
||||
DEBUG_WORD(DUP, W_REC, "Debug weeding of duplicate names"),
|
||||
DEBUG_WORD(EXIT, W_CLI|W_SRV, "Debug exit events (levels 1-2)"),
|
||||
DEBUG_WORD(EXIT, W_CLI|W_SRV, "Debug exit events (levels 1-3)"),
|
||||
DEBUG_WORD(FILTER, W_SND|W_REC, "Debug filter actions (levels 1-2)"),
|
||||
DEBUG_WORD(FLIST, W_SND|W_REC, "Debug file-list operations (levels 1-4)"),
|
||||
DEBUG_WORD(FUZZY, W_REC, "Debug fuzzy scoring (levels 1-2)"),
|
||||
|
||||
Reference in new issue
Block a user