]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
istream-chain: Final fixes to handling merged streams.
authorTimo Sirainen <tss@iki.fi>
Thu, 4 Apr 2013 19:09:02 +0000 (22:09 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 4 Apr 2013 19:09:02 +0000 (22:09 +0300)
src/lib/istream-chain.c

index b4084ebcffbd58efc58a5b194889de78dc157c99..1e5f0ba2584e69f27db18dc3e45b0b6bcc9ad0a5 100644 (file)
@@ -119,7 +119,7 @@ static void i_stream_chain_read_next(struct chain_istream *cstream)
        if (link != NULL && link->stream != NULL)
                i_stream_seek(link->stream, 0);
 
-       if (cstream->istream.buffer == cstream->istream.w_buffer) {
+       if (cstream->prev_stream_left > 0) {
                /* we've already buffered some of the prev_input. continue
                   appending the rest to it. */
                cur_data_pos = cstream->istream.pos -
@@ -145,7 +145,7 @@ static void i_stream_chain_read_next(struct chain_istream *cstream)
        cstream->istream.pos += data_size;
        cstream->prev_stream_left += data_size;
 
-       i_stream_skip(prev_input, data_size);
+       i_stream_skip(prev_input, i_stream_get_data_size(prev_input));
        i_stream_unref(&prev_input);
 }