*** empty log message ***
[rsync/rsync.git] / match.c
diff --git a/match.c b/match.c
index ee22ca3..f8a3607 100644 (file)
--- a/match.c
+++ b/match.c
@@ -19,6 +19,8 @@
 
 #include "rsync.h"
 
+extern int csum_length;
+
 extern int verbose;
 extern int am_server;
 
@@ -83,6 +85,19 @@ static void build_hash_table(struct sum_struct *s)
 }
 
 
+static void send_match(int f,int i)
+{
+  static int matches[32];
+  static int match_count=0;
+
+  matches[match_count++] = i;
+  if (match_count == 32 || i==0) {
+    int i;
+    for (i=0;i<match_count;i++)
+      write_int(f,matches[i]);
+    match_count=0;
+  }
+}
 
 static off_t last_match;
 
@@ -101,13 +116,13 @@ static void matched(int f,struct sum_struct *s,char *buf,off_t len,
     int l = 0;
     write_int(f,n);
     while (l < n) {
-      int n1 = MIN(WRITE_BLOCK_SIZE,n-l);
+      int n1 = MIN(CHUNK_SIZE,n-l);
       write_buf(f,map_ptr(buf,last_match+l,n1),n1);
       l += n1;
     }
     data_transfer += n;
   }
-  write_int(f,-(i+1));
+  send_match(f,-(i+1));
   if (i != -1)
     last_match = offset + s->sums[i].len;
   if (n > 0)
@@ -170,7 +185,7 @@ static void hash_search(int f,struct sum_struct *s,char *buf,off_t len)
            get_checksum2(map,l,sum2);
            done_csum2 = 1;
          }
-         if (memcmp(sum2,s->sums[i].sum2,SUM_LENGTH) == 0) {
+         if (memcmp(sum2,s->sums[i].sum2,csum_length) == 0) {
            matched(f,s,buf,len,offset,i);
            offset += s->sums[i].len - 1;
            k = MIN((len-offset), s->n);