[dovecot-cvs] dovecot/src/lib-mail istream-header-filter.c,1.1,1.2
cras at dovecot.org
cras at dovecot.org
Wed Jul 7 16:36:31 EEST 2004
Update of /home/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv27113/lib-mail
Modified Files:
istream-header-filter.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-header-filter.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/istream-header-filter.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- istream-header-filter.c 20 Jun 2004 06:20:32 -0000 1.1
+++ istream-header-filter.c 7 Jul 2004 13:36:29 -0000 1.2
@@ -71,19 +71,22 @@
mstream->header_size.physical_size);
}
- ret = i_stream_read(mstream->input);
-
- mstream->istream.pos -= mstream->istream.skip;
- mstream->istream.skip = 0;
-
- mstream->istream.buffer = i_stream_get_data(mstream->input, &pos);
- if (pos <= mstream->istream.pos) {
- i_assert(ret <= 0);
- } else {
- ret = pos - mstream->istream.pos;
- mstream->istream.pos = pos;
+ stream->buffer = i_stream_get_data(mstream->input, &pos);
+ if (pos <= stream->pos) {
+ if (i_stream_read(mstream->input) == -2) {
+ if (stream->skip == 0)
+ return -2;
+ }
+ stream->istream.disconnected = mstream->input->disconnected;
+ stream->buffer = i_stream_get_data(mstream->input, &pos);
}
+ stream->pos -= mstream->istream.skip;
+ stream->skip = 0;
+
+ ret = pos <= stream->pos ? -1 :
+ (ssize_t) (pos - stream->pos);
+ stream->pos = pos;
return ret;
}
More information about the dovecot-cvs
mailing list