summaryrefslogtreecommitdiff
path: root/token.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-05-22 01:53:02 +0000
committerAndrew Tridgell <tridge@samba.org>1998-05-22 01:53:02 +0000
commit45f133b9769fb45a329d3d41e121109d430e307d (patch)
tree4f666d6ebb0e7ea64f63fe397128a29319ed0c54 /token.c
parentc5eb365011581bdf9987b538f0df04a1d6feb723 (diff)
downloadrsync-45f133b9769fb45a329d3d41e121109d430e307d.tar.gz
rsync-45f133b9769fb45a329d3d41e121109d430e307d.tar.bz2
rsync-45f133b9769fb45a329d3d41e121109d430e307d.zip
this fixes two problems:
1) handle 64 bit file offsets in the token code. I wonder how large bit files worked up till now? 2) send a null token when we have passed over a large lump of data without finding a token match. This reduces the number of IOs considerably as it removes the need for seeks/reads on the checksum calculation and literal send code. This is not enabled yet for the compressed case as the deflate token code can't handle it yet.
Diffstat (limited to 'token.c')
-rw-r--r--token.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/token.c b/token.c
index 543031e4..318bdbc2 100644
--- a/token.c
+++ b/token.c
@@ -51,7 +51,7 @@ static int simple_recv_token(int f,char **data)
/* non-compressing send token */
static void simple_send_token(int f,int token,
- struct map_struct *buf,int offset,int n)
+ struct map_struct *buf,OFF_T offset,int n)
{
if (n > 0) {
int l = 0;
@@ -62,7 +62,10 @@ static void simple_send_token(int f,int token,
l += n1;
}
}
- write_int(f,-(token+1));
+ /* a -2 token means to send data only and no token */
+ if (token != -2) {
+ write_int(f,-(token+1));
+ }
}
@@ -103,7 +106,7 @@ static char *obuf;
/* Send a deflated token */
static void
send_deflated_token(int f, int token,
- struct map_struct *buf, int offset, int nb, int toklen)
+ struct map_struct *buf, OFF_T offset, int nb, int toklen)
{
int n, r;
static int init_done;
@@ -350,7 +353,7 @@ see_deflate_token(char *buf, int len)
* If token == -1 then we have reached EOF
* If n == 0 then don't send a buffer
*/
-void send_token(int f,int token,struct map_struct *buf,int offset,
+void send_token(int f,int token,struct map_struct *buf,OFF_T offset,
int n,int toklen)
{
if (!do_compression) {