diff options
-rw-r--r-- | src/or/buffers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 8648c30786..8f81eb2267 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -249,13 +249,13 @@ buf_shrink(buf_t *buf) { size_t new_len; - if (buf->highwater >= (buf->len<<2) && buf->len > MIN_LAZY_SHRINK_SIZE*2) - return; - - new_len = (buf->len>>1); + new_len = buf->len; while (buf->highwater < (new_len>>2) && new_len > MIN_LAZY_SHRINK_SIZE*2) new_len >>= 1; + if (new_len == buf->len) + return; + log_fn(LOG_DEBUG,"Shrinking buffer from %d to %d bytes.", (int)buf->len, (int)new_len); buf_resize(buf, new_len); |