Rsync error on client end: unexpected tag 3 [sender]

Wayne Davison wayned at samba.org
Thu May 18 17:53:32 GMT 2006


On Tue, May 02, 2006 at 10:30:39PM -0700, Wayne Davison wrote:
> The attached patch should fix the problem.  I've also checked the fix
> into CVS (and it will appear in the next nightly tar file that gets
> generated).

The patch I posted earlier works fine to fix this problem, but I ended
up with a slightly cleaner fix in CVS when all was said and done.  Here
is an updated patch for 2.6.8 that fixes this tag-3 problem the way CVS
now fixes it.

..wayne..
-------------- next part --------------
--- old/io.c	2006-04-21 09:40:19 -0700
+++ new/io.c	2006-05-18 10:45:16 -0700
@@ -273,10 +273,7 @@ static void read_msg_fd(void)
 			exit_cleanup(RERR_STREAMIO);
 		}
 		read_loop(fd, buf, len);
-		if (defer_forwarding_messages)
-			msg_list_add(&msg2sndr, MSG_DELETED, buf, len);
-		else
-			io_multiplex_write(MSG_DELETED, buf, len);
+		send_msg(MSG_DELETED, buf, len);
 		break;
 	case MSG_SUCCESS:
 		if (len != 4 || !am_generator) {
@@ -286,10 +283,7 @@ static void read_msg_fd(void)
 		read_loop(fd, buf, len);
 		if (remove_sent_files) {
 			decrement_active_files(IVAL(buf,0));
-			if (defer_forwarding_messages)
-				msg_list_add(&msg2sndr, MSG_SUCCESS, buf, len);
-			else
-				io_multiplex_write(MSG_SUCCESS, buf, len);
+			send_msg(MSG_SUCCESS, buf, len);
 		}
 		if (preserve_hard_links)
 			flist_ndx_push(&hlink_list, IVAL(buf,0));
@@ -309,10 +303,7 @@ static void read_msg_fd(void)
 			if (n >= sizeof buf)
 				n = sizeof buf - 1;
 			read_loop(fd, buf, n);
-			if (am_generator && am_server && defer_forwarding_messages)
-				msg_list_add(&msg2sndr, tag, buf, n);
-			else
-				rwrite((enum logcode)tag, buf, n);
+			rwrite(tag, buf, n);
 			len -= n;
 		}
 		break;
@@ -386,14 +377,19 @@ static int msg2genr_flush(int flush_it_a
 	return 1;
 }
 
-void send_msg(enum msgcode code, char *buf, int len)
+int send_msg(enum msgcode code, char *buf, int len)
 {
 	if (msg_fd_out < 0) {
-		io_multiplex_write(code, buf, len);
-		return;
+		if (!defer_forwarding_messages)
+			return io_multiplex_write(code, buf, len);
+		if (!io_multiplexing_out)
+			return 0;
+		msg_list_add(&msg2sndr, code, buf, len);
+		return 1;
 	}
 	msg_list_add(&msg2genr, code, buf, len);
 	msg2genr_flush(NORMAL_FLUSH);
+	return 1;
 }
 
 int get_redo_num(int itemizing, enum logcode code)
--- old/log.c	2006-04-08 09:04:34 -0700
+++ new/log.c	2006-05-18 10:45:16 -0700
@@ -264,7 +264,7 @@ void rwrite(enum logcode code, char *buf
 
 	if (am_server) {
 		/* Pass the message to the non-server side. */
-		if (io_multiplex_write((enum msgcode)code, buf, len))
+		if (send_msg((enum msgcode)code, buf, len))
 			return;
 		if (am_daemon) {
 			/* TODO: can we send the error to the user somehow? */
--- old/proto.h	2006-04-22 08:38:34 -0700
+++ new/proto.h	2006-05-18 10:45:31 -0700
@@ -104,7 +104,7 @@ void set_msg_fd_in(int fd);
 void set_msg_fd_out(int fd);
 void increment_active_files(int ndx, int itemizing, enum logcode code);
 void decrement_active_files(int ndx);
-void send_msg(enum msgcode code, char *buf, int len);
+int send_msg(enum msgcode code, char *buf, int len);
 int get_redo_num(int itemizing, enum logcode code);
 int get_hlink_num(void);
 void io_set_filesfrom_fds(int f_in, int f_out);


More information about the rsync mailing list