Moved write_sum_head() here from generator.c.
authorWayne Davison <wayned@samba.org>
Wed, 19 Jan 2005 20:10:50 +0000 (20:10 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 19 Jan 2005 20:10:50 +0000 (20:10 +0000)
io.c

diff --git a/io.c b/io.c
index 762cf81..e2dc152 100644 (file)
--- a/io.c
+++ b/io.c
@@ -804,6 +804,23 @@ void read_sum_head(int f, struct sum_struct *sum)
        }
 }
 
+/* Send the values from a sum_struct over the socket.  Set sum to
+ * NULL if there are no checksums to send.  This is called by both
+ * the generator and the sender. */
+void write_sum_head(int f, struct sum_struct *sum)
+{
+       static struct sum_struct null_sum;
+
+       if (sum == NULL)
+               sum = &null_sum;
+
+       write_int(f, sum->count);
+       write_int(f, sum->blength);
+       if (protocol_version >= 27)
+               write_int(f, sum->s2length);
+       write_int(f, sum->remainder);
+}
+
 
 /**
  * Sleep after writing to limit I/O bandwidth usage.