Added some debug output for MSG_ERROR_EXIT messages.
extern char *partial_dir;
extern char *logfile_name;
+BOOL shutting_down = False;
+
#ifdef HAVE_SIGACTION
static struct sigaction sigact;
#endif
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 */
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();
}
}
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);
}
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;
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;
uchar fnamecmp_type;
char xname[MAXPATHLEN];
+ shutting_down = True;
+
if (protocol_version < 29)
i = read_int(f_in);
else {
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);
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)"),