diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-06-18 09:03:48 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-06-18 09:03:48 +0000 |
commit | 11c2e97d51ad0e6d2b73067f0aabf83f61fb80d5 (patch) | |
tree | c75ebf9c1c10c0e00415d223e60cf8c3db5e1f07 | |
parent | 337ad6420b1826e5895225c54259d0b4f25053ad (diff) | |
download | tor-11c2e97d51ad0e6d2b73067f0aabf83f61fb80d5.tar tor-11c2e97d51ad0e6d2b73067f0aabf83f61fb80d5.tar.gz |
Another _zlib fix.
svn:r6652
-rw-r--r-- | src/or/buffers.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 872e40994..e1ec60edd 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1296,7 +1296,8 @@ write_to_buf_zlib(buf_t *buf, tor_zlib_state_t *state, { char *next; size_t old_avail, avail; - while (1) { + int over = 0; + while (!over) { buf_ensure_capacity(buf, buf->datalen + 1024); next = _buf_end(buf); if (next < buf->cur) @@ -1305,12 +1306,13 @@ write_to_buf_zlib(buf_t *buf, tor_zlib_state_t *state, old_avail = avail = (buf->mem + buf->datalen) - buf->cur; switch (tor_zlib_process(state, &next, &avail, &data, &data_len, done)) { case TOR_ZLIB_DONE: - return 0; + over = 1; + break; case TOR_ZLIB_ERR: return -1; case TOR_ZLIB_OK: if (data_len == 0) - return 0; + over = 1; break; case TOR_ZLIB_BUF_FULL: if (avail && buf->len >= 1024 + buf->datalen) { @@ -1335,6 +1337,8 @@ write_to_buf_zlib(buf_t *buf, tor_zlib_state_t *state, if (buf->datalen > buf->highwater) buf->highwater = buf->datalen; buf_total_used += old_avail - avail; + if (over) + return 0; } } |