Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2657:b89f471a0e04 HEAD
When corked, don't limit buffer size to optimal_block_size. Fixes problems
with some command replies not being sent completely with IMAP, or crashes
with pop3.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 23 Sep 2004 12:51:48 +0300 |
parents | 4a708855a533 |
children | fd607e2be4a9 |
files | src/lib/ostream-file.c |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ostream-file.c Thu Sep 23 12:40:48 2004 +0300 +++ b/src/lib/ostream-file.c Thu Sep 23 12:51:48 2004 +0300 @@ -296,16 +296,18 @@ static void o_stream_grow_buffer(struct file_ostream *fstream, size_t bytes) { - size_t size, head_size; + size_t size, head_size, new_size; size = nearest_power(fstream->buffer_size + bytes); if (size > fstream->max_buffer_size) { /* limit the size */ size = fstream->max_buffer_size; } else if (fstream->corked) { - /* use optimal buffer size with corking */ - size = I_MIN(fstream->optimal_block_size, - fstream->max_buffer_size); + /* try to use optimal buffer size with corking */ + new_size = I_MIN(fstream->optimal_block_size, + fstream->max_buffer_size); + if (new_size > size) + size = new_size; } if (size <= fstream->buffer_size)