This especially fixes hangs with IMAP COMPRESS handling in proxies.
}
if ((size_t)ret != size) {
zstream->outbuf_offset += ret;
+ /* We couldn't send everything to parent stream, but we
+ accepted all the input already. Set the ostream's flush
+ pending so when there's more space in the parent stream
+ we'll continue sending the rest of the data. */
+ o_stream_set_flush_pending(&zstream->ostream.ostream, TRUE);
return 0;
}
zstream->outbuf_offset = 0;
zstream->zs.next_out = zstream->outbuf;
zstream->zs.avail_out = sizeof(zstream->outbuf);
+ o_stream_init_buffering_flush(&zstream->ostream, output);
return o_stream_create(&zstream->ostream, output,
o_stream_get_fd(output));
}
}
if ((size_t)ret != size) {
zstream->outbuf_offset += ret;
+ /* We couldn't send everything to parent stream, but we
+ accepted all the input already. Set the ostream's flush
+ pending so when there's more space in the parent stream
+ we'll continue sending the rest of the data. */
+ o_stream_set_flush_pending(&zstream->ostream.ostream, TRUE);
return 0;
}
zstream->outbuf_offset = 0;
hdr->max_uncompressed_chunk_size[3] =
(OSTREAM_LZ4_CHUNK_SIZE & 0x000000ff);
zstream->outbuf_used = sizeof(*hdr);
+ o_stream_init_buffering_flush(&zstream->ostream, output);
return o_stream_create(&zstream->ostream, output,
o_stream_get_fd(output));
}
}
i_assert((size_t)ret <= zstream->header_bytes_left);
zstream->header_bytes_left -= ret;
- return zstream->header_bytes_left == 0 ? 1 : 0;
+ if (zstream->header_bytes_left != 0) {
+ o_stream_set_flush_pending(&zstream->ostream.ostream, TRUE);
+ return 0;
+ }
+ return 1;
}
static int o_stream_zlib_lsb_uint32(struct ostream *output, uint32_t num)
}
if ((size_t)ret != size) {
zstream->outbuf_offset += ret;
+ /* We couldn't send everything to parent stream, but we
+ accepted all the input already. Set the ostream's flush
+ pending so when there's more space in the parent stream
+ we'll continue sending the rest of the data. */
+ o_stream_set_flush_pending(&zstream->ostream.ostream, TRUE);
return 0;
}
zstream->outbuf_offset = 0;
zstream->zs.next_out = zstream->outbuf;
zstream->zs.avail_out = sizeof(zstream->outbuf);
+ o_stream_init_buffering_flush(&zstream->ostream, output);
return o_stream_create(&zstream->ostream, output,
o_stream_get_fd(output));
}
memmove(zstream->outbuf, zstream->outbuf+ret, zstream->output.pos-ret);
zstream->output.pos -= ret;
}
- if (zstream->output.pos > 0)
+ if (zstream->output.pos > 0) {
+ /* We couldn't send everything to parent stream, but we
+ accepted all the input already. Set the ostream's flush
+ pending so when there's more space in the parent stream
+ we'll continue sending the rest of the data. */
+ o_stream_set_flush_pending(&zstream->ostream.ostream, TRUE);
return 0;
+ }
return 1;
}
zstream->output.dst = zstream->outbuf;
zstream->output.size = ZSTD_CStreamOutSize();
}
+ o_stream_init_buffering_flush(&zstream->ostream, output);
return o_stream_create(&zstream->ostream, output,
o_stream_get_fd(output));
}