diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-06-27 10:32:50 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-06-27 10:32:50 -0400 |
commit | 22f441d4ee40a6d1c9615aeb2b08b872549abfd0 (patch) | |
tree | 123915bc9ab1f3f0c686dfd4a4c73f23c91a33a6 /src/or/buffers.c | |
parent | f6df433b9123c50b8eda6d8784d4f96be6d02f51 (diff) | |
parent | fd16dd2608ba3a1f97fb13bf7ae3b6640e90376a (diff) | |
download | tor-22f441d4ee40a6d1c9615aeb2b08b872549abfd0.tar.gz tor-22f441d4ee40a6d1c9615aeb2b08b872549abfd0.zip |
Merge branch 'maint-0.3.1'
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 1907d69cfb..d0639b81eb 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -2084,7 +2084,7 @@ fetch_from_buf_line(buf_t *buf, char *data_out, size_t *data_len) int write_to_buf_compress(buf_t *buf, tor_compress_state_t *state, const char *data, size_t data_len, - int done) + const int done) { char *next; size_t old_avail, avail; @@ -2106,8 +2106,10 @@ write_to_buf_compress(buf_t *buf, tor_compress_state_t *state, case TOR_COMPRESS_ERROR: return -1; case TOR_COMPRESS_OK: - if (data_len == 0) + if (data_len == 0) { + tor_assert_nonfatal(!done); over = 1; + } break; case TOR_COMPRESS_BUFFER_FULL: if (avail) { @@ -2116,6 +2118,11 @@ write_to_buf_compress(buf_t *buf, tor_compress_state_t *state, * whether were going to or not. */ need_new_chunk = 1; } + if (data_len == 0 && !done) { + /* We've consumed all the input data, though, so there's no + * point in forging ahead right now. */ + over = 1; + } break; } buf->datalen += old_avail - avail; |