save some more bytes by making the checksum smaller
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index a088720..d6389f1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -46,6 +46,8 @@ int delete_mode=0;
 int one_file_system=0;
 int remote_version=0;
 int sparse_files=0;
+int do_compression=0;
+
 extern int csum_length;
 
 int am_server = 0;
@@ -91,7 +93,6 @@ static void server_options(char **args,int *argc)
   int ac = *argc;
   static char argstr[50];
   static char bsize[30];
-  static char slength[30];
   int i, x;
 
   args[ac++] = "--server";
@@ -144,11 +145,6 @@ static void server_options(char **args,int *argc)
     args[ac++] = bsize;
   }    
 
-  if (csum_length != SUM_LENGTH) {
-    sprintf(slength,"--csum-length=%d",csum_length);
-    args[ac++] = slength;
-  }    
-  
   if (delete_mode)
     args[ac++] = "--delete";
 
@@ -304,12 +300,19 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
 {
   int pid;
   int status=0;
+  int recv_pipe[2];
 
   if (preserve_hard_links)
     init_hard_links(flist);
 
+  if (pipe(recv_pipe) < 0) {
+    fprintf(FERROR,"pipe failed in do_recv\n");
+    exit(1);
+  }
+  
+
   if ((pid=fork()) == 0) {
-    recv_files(f_in,flist,local_name);
+    recv_files(f_in,flist,local_name,recv_pipe[1]);
     if (preserve_hard_links)
       do_hard_links(flist);
     if (verbose > 2)
@@ -317,7 +320,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
     exit_cleanup(0);
   }
 
-  generate_files(f_out,flist,local_name);
+  generate_files(f_out,flist,local_name,recv_pipe[0]);
 
   waitpid(pid, &status, 0);
 
@@ -408,7 +411,7 @@ static void usage(FILE *f)
 }
 
 enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
-      OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH,OPT_CSUM_LENGTH};
+      OPT_EXCLUDE_FROM,OPT_DELETE,OPT_RSYNC_PATH};
 
 static char *short_options = "oblHpguDCtcahvrIxnSe:B:";
 
@@ -420,7 +423,6 @@ static struct option long_options[] = {
   {"exclude",     1,     0,    OPT_EXCLUDE},
   {"exclude-from",1,     0,    OPT_EXCLUDE_FROM},
   {"rsync-path",  1,     0,    OPT_RSYNC_PATH},
-  {"csum-length", 1,     0,    OPT_CSUM_LENGTH},
   {"one-file-system",0,  0,    'x'},
   {"ignore-times",0,     0,    'I'},
   {"help",        0,     0,    'h'},
@@ -461,8 +463,6 @@ int main(int argc,char *argv[])
 
     starttime = time(NULL);
 
-    checksum_init();
-
     while ((opt = getopt_long(argc, argv, 
                              short_options, long_options, &option_index)) 
           != -1) {
@@ -481,11 +481,6 @@ int main(int argc,char *argv[])
          rsync_path = optarg;
          break;
 
-       case OPT_CSUM_LENGTH:
-         csum_length = atoi(optarg);
-         csum_length = MIN(csum_length,SUM_LENGTH);
-         break;
-
        case 'I':
          ignore_times = 1;
          break;
@@ -638,16 +633,7 @@ int main(int argc,char *argv[])
       verbose = MAX(verbose,1);
 
     if (am_server) {
-      remote_version = read_int(STDIN_FILENO);
-      if (remote_version < MIN_PROTOCOL_VERSION ||
-         remote_version > MAX_PROTOCOL_VERSION) {
-       fprintf(FERROR,"protocol version mismatch - is your shell clean?\n");
-       exit_cleanup(1);
-      }
-      write_int(STDOUT_FILENO,PROTOCOL_VERSION);
-      write_flush(STDOUT_FILENO);
-
-      setup_protocol();
+      setup_protocol(STDOUT_FILENO,STDIN_FILENO);
        
       if (sender) {
        recv_exclude_list(STDIN_FILENO);
@@ -717,18 +703,7 @@ int main(int argc,char *argv[])
 
     pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path,&f_in,&f_out);
 
-    write_int(f_out,PROTOCOL_VERSION);
-    write_flush(f_out);
-    {
-      remote_version = read_int(f_in);
-      if (remote_version < MIN_PROTOCOL_VERSION ||
-         remote_version > MAX_PROTOCOL_VERSION) {
-       fprintf(FERROR,"protocol version mismatch - is your shell clean?\n");
-       exit_cleanup(1);
-      }        
-    }
-
-    setup_protocol();
+    setup_protocol(f_out,f_in);
 
     if (verbose > 3) 
       fprintf(FERROR,"parent=%d child=%d sender=%d recurse=%d\n",