[RFC] protocol version deadwood removal
jw schultz
jw at pegasys.ws
Thu Mar 27 11:02:49 EST 2003
Attached patch illustrates* the dead code removal.
Code providing backwards compatability with protocol versions
prior to 15 is excised.
* for the sake of readability patch is made with diff -ub so
indentation changes are not observed. Actual changes will
fix indentation on no-longer conditional code.
--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
-------------- next part --------------
Index: checksum.c
===================================================================
RCS file: /data/cvs/rsync/checksum.c,v
retrieving revision 1.23
diff -u -b -r1.23 checksum.c
--- checksum.c 8 Apr 2002 08:29:04 -0000 1.23
+++ checksum.c 26 Mar 2003 23:55:00 -0000
@@ -117,16 +117,6 @@
}
-void checksum_init(void)
-{
- if (remote_version >= 14)
- csum_length = 2; /* adaptive */
- else
- csum_length = SUM_LENGTH;
-}
-
-
-
static int sumresidue;
static char sumrbuf[CSUM_CHUNK];
static struct mdfour md;
Index: compat.c
===================================================================
RCS file: /data/cvs/rsync/compat.c,v
retrieving revision 1.17
diff -u -b -r1.17 compat.c
--- compat.c 24 Mar 2003 22:42:46 -0000 1.17
+++ compat.c 26 Mar 2003 23:55:00 -0000
@@ -65,7 +65,6 @@
rprintf(FINFO,"%s is very old version of rsync, upgrade recommended.\n",
am_server ? "Server" : "Client");
- if (remote_version >= 12) {
if (am_server) {
if (read_batch || write_batch) /* dw */
checksum_seed = 32761;
@@ -75,8 +74,5 @@
} else {
checksum_seed = read_int(f_in);
}
- }
-
- checksum_init();
}
Index: flist.c
===================================================================
RCS file: /data/cvs/rsync/flist.c,v
retrieving revision 1.132
diff -u -b -r1.132 flist.c
--- flist.c 21 Mar 2003 22:53:46 -0000 1.132
+++ flist.c 26 Mar 2003 23:55:01 -0000
@@ -1020,7 +1020,7 @@
/* now send the uid/gid list. This was introduced in protocol
version 15 */
- if (f != -1 && remote_version >= 15) {
+ if (f != -1) {
send_uid_list(f);
}
@@ -1100,7 +1100,7 @@
}
/* now recv the uid/gid list. This was introduced in protocol version 15 */
- if (f != -1 && remote_version >= 15) {
+ if (f != -1) {
recv_uid_list(f, flist);
}
Index: generator.c
===================================================================
RCS file: /data/cvs/rsync/generator.c,v
retrieving revision 1.48
diff -u -b -r1.48 generator.c
--- generator.c 26 Mar 2003 20:26:06 -0000 1.48
+++ generator.c 26 Mar 2003 23:55:01 -0000
@@ -516,13 +516,11 @@
write_int(f,-1);
- if (remote_version >= 13) {
- /* in newer versions of the protocol the files can cycle through
- the system more than once to catch initial checksum errors */
+ /* files can cycle through the system more than once
+ * to catch initial checksum errors */
for (i=read_int(f_recv); i != -1; i=read_int(f_recv)) {
struct file_struct *file = flist->files[i];
- recv_generator(local_name?local_name:f_name(file),
- flist,i,f);
+ recv_generator(local_name?local_name:f_name(file), flist,i,f);
}
phase++;
@@ -530,5 +528,4 @@
rprintf(FINFO,"generate_files phase=%d\n",phase);
write_int(f,-1);
- }
}
Index: match.c
===================================================================
RCS file: /data/cvs/rsync/match.c,v
retrieving revision 1.51
diff -u -b -r1.51 match.c
--- match.c 9 Apr 2002 06:11:06 -0000 1.51
+++ match.c 26 Mar 2003 23:55:02 -0000
@@ -24,8 +24,6 @@
extern int verbose;
extern int am_server;
-extern int remote_version;
-
typedef unsigned short tag;
#define TABLESIZE (1<<16)
@@ -322,13 +320,11 @@
sum_end(file_sum);
- if (remote_version >= 14) {
if (verbose > 2)
rprintf(FINFO,"sending file_sum\n");
write_buf(f,file_sum,MD4_SUM_LENGTH);
if (write_batch) /* dw */
write_batch_delta_file(file_sum, MD4_SUM_LENGTH);
- }
if (targets) {
free(targets);
Index: proto.h
===================================================================
RCS file: /data/cvs/rsync/proto.h,v
retrieving revision 1.154
diff -u -b -r1.154 proto.h
--- proto.h 25 Mar 2003 05:46:52 -0000 1.154
+++ proto.h 26 Mar 2003 23:55:02 -0000
@@ -27,7 +27,6 @@
uint32 get_checksum1(char *buf1,int len);
void get_checksum2(char *buf,int len,char *sum);
void file_checksum(char *fname,char *sum,OFF_T size);
-void checksum_init(void);
void sum_init(void);
void sum_update(char *p, int len);
void sum_end(char *sum);
Index: receiver.c
===================================================================
RCS file: /data/cvs/rsync/receiver.c,v
retrieving revision 1.44
diff -u -b -r1.44 receiver.c
--- receiver.c 26 Mar 2003 11:04:14 -0000 1.44
+++ receiver.c 26 Mar 2003 23:55:02 -0000
@@ -306,16 +306,14 @@
sum_end(file_sum1);
- if (remote_version >= 14) {
read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
if (verbose > 2) {
rprintf(FINFO,"got file_sum\n");
}
- if (fd != -1 &&
- memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0) {
+ if (fd != -1
+ && memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0) {
return 0;
}
- }
return 1;
}
@@ -353,7 +351,7 @@
i = read_int(f_in);
if (i == -1) {
- if (phase==0 && remote_version >= 13) {
+ if (phase==0) {
phase++;
csum_length = SUM_LENGTH;
if (verbose > 2)
Index: sender.c
===================================================================
RCS file: /data/cvs/rsync/sender.c,v
retrieving revision 1.18
diff -u -b -r1.18 sender.c
--- sender.c 25 Mar 2003 02:28:54 -0000 1.18
+++ sender.c 26 Mar 2003 23:55:02 -0000
@@ -20,7 +20,6 @@
#include "rsync.h"
extern int verbose;
-extern int remote_version;
extern int csum_length;
extern struct stats stats;
extern int io_error;
@@ -118,7 +117,7 @@
i = read_int(f_in);
if (i == -1) {
- if (phase==0 && remote_version >= 13) {
+ if (phase==0) {
phase++;
csum_length = SUM_LENGTH;
write_int(f_out,-1);
More information about the rsync
mailing list