common/iobuf.c: Adjust buffer size of filters in front of temp filters.

* common/iobuf.c (iobuf_push_filter2): If the head filter is a temp
filter, use IOBUF_BUFFER_SIZE for the new filter.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
Neal H. Walfield 2015-08-17 12:29:15 +02:00
parent 827cc922d8
commit 0d40c4e83f
1 changed files with 15 additions and 2 deletions

View File

@ -1604,8 +1604,21 @@ iobuf_push_filter2 (iobuf_t a,
a->filter_ov_owner = 0;
a->filter_eof = 0;
if (a->use == IOBUF_TEMP)
/* make a write stream from a temp stream */
a->use = IOBUF_OUTPUT;
/* A TEMP filter buffers any data sent to it; it does not forward
any data down the pipeline. If we add a new filter to the
pipeline, it shouldn't also buffer data. It should send it
downstream to be buffered. Thus, the correct type for a filter
added in front of an IOBUF_TEMP filter is IOBUF_OUPUT, not
IOBUF_TEMP. */
{
a->use = IOBUF_OUTPUT;
/* When pipeline is written to, the temp buffer's size is
increased accordingly. We don't need to allocate a 10 MB
buffer for a non-terminal filter. Just use the default
size. */
a->d.size = IOBUF_BUFFER_SIZE;
}
/* The new filter (A) gets a new buffer.