diff options
author | Krzysztof Krzyżaniak <eloy@debian.org> | 2006-09-25 08:27:05 +0000 |
---|---|---|
committer | Krzysztof Krzyżaniak <eloy@debian.org> | 2006-09-25 08:27:05 +0000 |
commit | cb3017146d5322069fe4003ffcd4c9ada74dacb8 (patch) | |
tree | 5a07eefc6cfd6c668292bfa3471d993dc3b88f1f /src/chunk.c | |
parent | 8e8fd7ec0fc30c1703a192edfceefac6ab5f0f0c (diff) | |
download | lighttpd-cb3017146d5322069fe4003ffcd4c9ada74dacb8.tar.gz |
eloy: new upstream version
Diffstat (limited to 'src/chunk.c')
-rw-r--r-- | src/chunk.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/chunk.c b/src/chunk.c index 3903428..776d59e 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -194,6 +194,22 @@ int chunkqueue_append_buffer(chunkqueue *cq, buffer *mem) { return 0; } +int chunkqueue_append_buffer_weak(chunkqueue *cq, buffer *mem) { + chunk *c; + + if (mem->used == 0) return 0; + + c = chunkqueue_get_unused_chunk(cq); + c->type = MEM_CHUNK; + c->offset = 0; + if (c->mem) buffer_free(c->mem); + c->mem = mem; + + chunkqueue_append_chunk(cq, c); + + return 0; +} + int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) { chunk *c; @@ -209,6 +225,7 @@ int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) { return 0; } + int chunkqueue_append_mem(chunkqueue *cq, const char * mem, size_t len) { chunk *c; @@ -355,7 +372,7 @@ int chunkqueue_remove_finished_chunks(chunkqueue *cq) { switch (c->type) { case MEM_CHUNK: - if (c->offset == (off_t)c->mem->used - 1) is_finished = 1; + if (c->mem->used == 0 || (c->offset == (off_t)c->mem->used - 1)) is_finished = 1; break; case FILE_CHUNK: if (c->offset == c->file.length) is_finished = 1; |