Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Commit

Permalink
0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Phipps committed Jan 15, 2006
1 parent df13af2 commit 4610a07
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 27 deletions.
60 changes: 60 additions & 0 deletions c/NEWS
@@ -0,0 +1,60 @@
Changes in 0.2.1
- fixed bug where zsync would loop if fed more than one local source file
- enabled zsync to handle gzip files containing stored (uncompressed) blocks (so we should do slightly better on gzipped binaries now - but this is still incomplete and will not work for all files)

Changes in 0.2.0
- major reduction in the size of the control file, due to some new optimisations
- further fixes for servers refusing to do multipart/byteranges responses

Changes in 0.1.6
- fixes some problems with compressed file downloads and unusual server responses
- improved http_proxy parsing

Changes in 0.1.5
- fixes some minor HTTP problems

Changes in 0.1.4
- fixed compilation with gcc-3.4

Changes in 0.1.3
- HTTP proxy support
- better HTTP support - we deal better with unusual server responses

Changes in 0.1.2
- fixes for Solaris/sparc

Changes in 0.1.1
- more efficient compressed stream support
- code cleanups

Changes in 0.1.0
- finished the cleanup of the compressed file transfer code
- major improvement in efficiency for compressed file transfers
- OpenSSL is no longer required
- now under the v2 Artistic License

Changes in 0.0.6
- just code cleanups and documentation updates

Changes in 0.0.5
- switch to OpenSSL's MD4 code
- fix checksumming at stream end
- fix various portability problems

Changes in 0.0.4
- relative URLs in .zsync files supported
- HTTP redirects are followed for the metafile
- now uses both compressed and uncompressed sources to further reduce download sizes

Changes in 0.0.3
- fix HTTP connection termination handling
- speed up local file reading

Changes in 0.0.2
- HTTP/1.1, with pipelining
- cleaning up more of the libc streams and mmap clutter
- progress displays
- lots of bugfixes

First release 0.0.1.

2 changes: 1 addition & 1 deletion c/README
@@ -1,4 +1,4 @@
zsync 0.2.0
zsync 0.2.1
===========

zsync is a file transfer program. It allows you to download a file from a
Expand Down
2 changes: 1 addition & 1 deletion c/client.c
Expand Up @@ -150,7 +150,7 @@ int read_zsync_control_stream(FILE* f, struct zsync_state** z, const char* sourc
fprintf(stderr,"nonsensical blocksize %d\n",blocksize); return -1;
}
} else if (!strcmp(buf, "Hash-Lengths")) {
if (sscanf(p,"%d,%d,%d",&seq_matches,&rsum_bytes,&checksum_bytes) != 3 || rsum_bytes < 1 || rsum_bytes > 4 || checksum_bytes < 4 || checksum_bytes > 16 || seq_matches > 2 || seq_matches < 1) {
if (sscanf(p,"%d,%d,%d",&seq_matches,&rsum_bytes,&checksum_bytes) != 3 || rsum_bytes < 1 || rsum_bytes > 4 || checksum_bytes < 3 || checksum_bytes > 16 || seq_matches > 2 || seq_matches < 1) {
fprintf(stderr,"nonsensical hash lengths line %s\n",p);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion c/configure.in
Expand Up @@ -5,7 +5,7 @@ AC_CONFIG_AUX_DIR(autotools)
dnl --- Set version strings
MAJOR_VERSION=0
MINOR_VERSION=2
MICRO_VERSION=0
MICRO_VERSION=1
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION

AC_SUBST(VERSION)
Expand Down
10 changes: 9 additions & 1 deletion c/lib/hash.c
Expand Up @@ -31,13 +31,20 @@ void add_target_block(struct zsync_state* z, zs_blockid b, struct rsum r, void*
memcpy(e->checksum, checksum, z->checksum_bytes);
e->r.a = r.a & z->rsum_a_mask;
e->r.b = r.b;
if (z->rsum_hash) {
free(z->rsum_hash); z->rsum_hash = NULL;
}
}
}

void build_hash(struct zsync_state* z)
int build_hash(struct zsync_state* z)
{
zs_blockid id;

z->hashmask = 0xffff;
z->rsum_hash = calloc(z->hashmask+1, sizeof *(z->rsum_hash));
if (!z->rsum_hash) return 0;

for (id = 0; id < z->blocks; id++) {
struct hash_entry* e = z->blockhashes + id;
/* Prepend to linked list for this hash entry */
Expand All @@ -46,5 +53,6 @@ void build_hash(struct zsync_state* z)
e->next = z->rsum_hash[h];
z->rsum_hash[h] = e;
}
return 1;
}

2 changes: 1 addition & 1 deletion c/lib/internal.h
Expand Up @@ -74,4 +74,4 @@ static inline unsigned calc_rhash(const struct zsync_state* const z, const struc
return h & z->hashmask;
}

void build_hash(struct zsync_state* z);
int build_hash(struct zsync_state* z);
5 changes: 4 additions & 1 deletion c/lib/rsum.c
Expand Up @@ -294,7 +294,10 @@ int submit_source_file(struct zsync_state* z, FILE* f)

if (!buf) return 0;

build_hash(z);
if (!z->rsum_hash)
if (!build_hash(z))
return 0;

while (!feof(f)) {
size_t len;
long long start_in = in;
Expand Down
22 changes: 9 additions & 13 deletions c/lib/state.c
Expand Up @@ -29,7 +29,7 @@ struct zsync_state* zsync_init(zs_blockid nblocks, size_t blocksize, int rsum_by
{
struct zsync_state* z = malloc(sizeof(struct zsync_state));

if (z != NULL){
if (z != NULL) {
/* Setup blocksize and shift. Size must be a power of two. */
z->blocksize = blocksize;
z->blocks = nblocks;
Expand All @@ -53,19 +53,15 @@ struct zsync_state* zsync_init(zs_blockid nblocks, size_t blocksize, int rsum_by
}
}

z->hashmask = 0xffff;
z->rsum_hash = calloc(z->hashmask+1, sizeof *(z->rsum_hash));
if (z->rsum_hash != NULL) {
z->ranges = NULL;
z->numranges = 0;
z->ranges = NULL;
z->rsum_hash = NULL;
z->numranges = 0;

z->blockhashes = malloc(sizeof(z->blockhashes[0]) * (z->blocks+z->seq_matches));
if (z->blockhashes != NULL)
return z;
z->blockhashes = malloc(sizeof(z->blockhashes[0]) * (z->blocks+z->seq_matches));
if (z->blockhashes != NULL)
return z;

/* All below is error handling */
free(z->rsum_hash);
}
/* All below is error handling */
}
}
free(z->filename);
Expand Down Expand Up @@ -96,7 +92,7 @@ void zsync_end(struct zsync_state* z)
unlink(z->filename);
free(z->filename);
}
free(z->rsum_hash);
if (z->rsum_hash) free(z->rsum_hash);
free(z->ranges); // Should be NULL already
fprintf(stderr,"hashhit %d, weakhit %d, checksummed %d, stronghit %d\n",z->stats.hashhit, z->stats.weakhit, z->stats.checksummed, z->stats.stronghit);
free(z);
Expand Down
4 changes: 2 additions & 2 deletions c/zlib/inflate.c
Expand Up @@ -1295,7 +1295,7 @@ void inflate_advance_bits(strm,b,s)
state->bits = 0;
state->hold = 0;
}
state->mode = s ? TYPEDO : LENDO;
state->mode = s ? TYPEDO : state->mode == COPY ? COPY : LENDO;
}

int ZEXPORT inflateSafePoint(strm)
Expand All @@ -1305,6 +1305,6 @@ z_streamp strm;

if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
return state->mode == LENDO;
return (state->mode == LENDO || state->mode == COPY);
}

50 changes: 44 additions & 6 deletions paper/paper.xml

Large diffs are not rendered by default.

0 comments on commit 4610a07

Please sign in to comment.