dovecot-2.2: lib-ssl-iostream: Implement get_used_size() method.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 9 12:12:55 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/3e78375be391
changeset: 17443:3e78375be391
user: Timo Sirainen <tss at iki.fi>
date: Mon Jun 09 15:11:50 2014 +0300
description:
lib-ssl-iostream: Implement get_used_size() method.
Previously we were always returning that we didn't have anything buffered,
which could have caused huge memory usage (or malloc failures) with its
users (e.g. dsync).
diffstat:
src/lib-ssl-iostream/ostream-openssl.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diffs (25 lines):
diff -r 5259f6320e52 -r 3e78375be391 src/lib-ssl-iostream/ostream-openssl.c
--- a/src/lib-ssl-iostream/ostream-openssl.c Mon Jun 09 13:41:59 2014 +0300
+++ b/src/lib-ssl-iostream/ostream-openssl.c Mon Jun 09 15:11:50 2014 +0300
@@ -188,6 +188,13 @@
return ret > 0 && ret2 > 0 ? 1 : 0;
}
+static size_t o_stream_ssl_get_used_size(const struct ostream_private *stream)
+{
+ struct ssl_ostream *sstream = (struct ssl_ostream *)stream;
+
+ return o_stream_get_buffer_used_size(sstream->ssl_io->plain_output);
+}
+
static void
o_stream_ssl_flush_pending(struct ostream_private *_stream, bool set)
{
@@ -221,6 +228,7 @@
sstream->ostream.flush = o_stream_ssl_flush;
sstream->ostream.switch_ioloop = o_stream_ssl_switch_ioloop;
+ sstream->ostream.get_used_size = o_stream_ssl_get_used_size;
sstream->ostream.flush_pending = o_stream_ssl_flush_pending;
sstream->ostream.iostream.set_max_buffer_size =
o_stream_ssl_set_max_buffer_size;
More information about the dovecot-cvs
mailing list