[dovecot-cvs] dovecot/src/lib istream-limit.c,1.5,1.6

cras at dovecot.org cras at dovecot.org
Wed Jul 7 16:36:31 EEST 2004


Update of /home/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv27113/lib

Modified Files:
	istream-limit.c 
Log Message:
Wrapper streams shouldn't try to read data if it's already buffered in main
stream. Fixes at least problem with APPEND when the whole message came in
one TCP packet.



Index: istream-limit.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-limit.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- istream-limit.c	19 Jun 2004 01:00:09 -0000	1.5
+++ istream-limit.c	7 Jul 2004 13:36:29 -0000	1.6
@@ -58,15 +58,18 @@
 			      stream->istream.v_offset);
 	}
 
-	if (i_stream_read(lstream->input) == -2 && stream->buffer != NULL) {
-		if (stream->skip == 0)
-			return -2;
+	stream->buffer = i_stream_get_data(lstream->input, &pos);
+	if (pos <= stream->pos) {
+		if (i_stream_read(lstream->input) == -2) {
+			if (stream->skip == 0)
+				return -2;
+		}
+		stream->istream.disconnected = lstream->input->disconnected;
+		stream->buffer = i_stream_get_data(lstream->input, &pos);
 	}
-	stream->istream.disconnected = lstream->input->disconnected;
 
 	stream->pos -= stream->skip;
 	stream->skip = 0;
-	stream->buffer = i_stream_get_data(lstream->input, &pos);
 
 	if (lstream->v_size != (uoff_t)-1) {
 		left = lstream->v_size - stream->istream.v_offset;



More information about the dovecot-cvs mailing list