[dovecot-cvs] dovecot/src/lib ostream-file.c,1.36,1.37

cras at dovecot.org cras at dovecot.org
Thu Sep 23 12:51:50 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv7659/lib

Modified Files:
	ostream-file.c 
Log Message:
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.



Index: ostream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- ostream-file.c	20 Sep 2004 21:27:43 -0000	1.36
+++ ostream-file.c	23 Sep 2004 09:51:48 -0000	1.37
@@ -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)



More information about the dovecot-cvs mailing list