dovecot: Set blocking/seekable flags.
dovecot at dovecot.org
dovecot at dovecot.org
Sat Oct 20 19:25:42 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/c4fa8b1ee24a
changeset: 6564:c4fa8b1ee24a
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 20 19:25:35 2007 +0300
description:
Set blocking/seekable flags.
diffstat:
2 files changed, 20 insertions(+), 3 deletions(-)
src/lib/istream-concat.c | 12 +++++++++++-
src/lib/istream-seekable.c | 11 +++++++++--
diffs (60 lines):
diff -r d85bfe89f4b8 -r c4fa8b1ee24a src/lib/istream-concat.c
--- a/src/lib/istream-concat.c Sat Oct 20 19:21:15 2007 +0300
+++ b/src/lib/istream-concat.c Sat Oct 20 19:25:35 2007 +0300
@@ -219,11 +219,19 @@ struct istream *i_stream_create_concat(s
struct concat_istream *cstream;
unsigned int count;
size_t max_buffer_size = I_STREAM_MIN_SIZE;
-
+ bool blocking = TRUE, seekable = TRUE;
+
+ /* if any of the streams isn't blocking or seekable, set ourself also
+ nonblocking/nonseekable */
for (count = 0; input[count] != NULL; count++) {
size_t cur_max = input[count]->real_stream->max_buffer_size;
+
if (cur_max > max_buffer_size)
max_buffer_size = cur_max;
+ if (!input[count]->blocking)
+ blocking = FALSE;
+ if (!input[count]->seekable)
+ seekable = FALSE;
i_stream_ref(input[count]);
}
i_assert(count != 0);
@@ -245,5 +253,7 @@ struct istream *i_stream_create_concat(s
cstream->istream.seek = i_stream_concat_seek;
cstream->istream.stat = i_stream_concat_stat;
+ cstream->istream.istream.blocking = blocking;
+ cstream->istream.istream.seekable = seekable;
return i_stream_create(&cstream->istream, -1, 0);
}
diff -r d85bfe89f4b8 -r c4fa8b1ee24a src/lib/istream-seekable.c
--- a/src/lib/istream-seekable.c Sat Oct 20 19:21:15 2007 +0300
+++ b/src/lib/istream-seekable.c Sat Oct 20 19:25:35 2007 +0300
@@ -301,9 +301,14 @@ i_stream_create_seekable(struct istream
const unsigned char *data;
unsigned int count;
size_t size;
-
- for (count = 0; input[count] != NULL; count++)
+ bool blocking = TRUE;
+
+ /* if any of the streams isn't blocking, set ourself also nonblocking */
+ for (count = 0; input[count] != NULL; count++) {
+ if (!input[count]->blocking)
+ blocking = FALSE;
i_stream_ref(input[count]);
+ }
i_assert(count != 0);
sstream = i_new(struct seekable_istream, 1);
@@ -329,5 +334,7 @@ i_stream_create_seekable(struct istream
sstream->istream.seek = i_stream_seekable_seek;
sstream->istream.stat = i_stream_seekable_stat;
+ sstream->istream.istream.blocking = blocking;
+ sstream->istream.istream.seekable = TRUE;
return i_stream_create(&sstream->istream, -1, 0);
}
More information about the dovecot-cvs
mailing list