From 87da941c0b0a0671997f592a52ee2c0b35d0e41e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 3 Apr 2014 19:54:27 +0300 Subject: [PATCH] lib-ssl-iostream: Make sure I/O input event is triggered after ostream-ssl has read some data to buffer. --- src/lib-ssl-iostream/iostream-openssl.c | 2 ++ src/lib-ssl-iostream/iostream-openssl.h | 1 + src/lib-ssl-iostream/istream-openssl.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/lib-ssl-iostream/iostream-openssl.c b/src/lib-ssl-iostream/iostream-openssl.c index 324cc52602..6b3dd92186 100644 --- a/src/lib-ssl-iostream/iostream-openssl.c +++ b/src/lib-ssl-iostream/iostream-openssl.c @@ -261,6 +261,7 @@ openssl_iostream_create(struct ssl_iostream_context *ctx, const char *host, if (ssl_io->plain_output->real_stream->error_handling_disabled) o_stream_set_no_error_handling(*output, TRUE); + ssl_io->ssl_input = *input; ssl_io->ssl_output = *output; *iostream_r = ssl_io; return 0; @@ -427,6 +428,7 @@ static bool openssl_iostream_bio_input(struct ssl_iostream *ssl_io) ssl_io->ostream_flush_waiting_input = FALSE; o_stream_set_flush_pending(ssl_io->plain_output, TRUE); } + i_stream_set_input_pending(ssl_io->ssl_input, TRUE); ssl_io->want_read = FALSE; } return bytes_read; diff --git a/src/lib-ssl-iostream/iostream-openssl.h b/src/lib-ssl-iostream/iostream-openssl.h index 5e9f4c8006..5f2870367f 100644 --- a/src/lib-ssl-iostream/iostream-openssl.h +++ b/src/lib-ssl-iostream/iostream-openssl.h @@ -26,6 +26,7 @@ struct ssl_iostream { struct istream *plain_input; struct ostream *plain_output; + struct istream *ssl_input; struct ostream *ssl_output; char *host; diff --git a/src/lib-ssl-iostream/istream-openssl.c b/src/lib-ssl-iostream/istream-openssl.c index 7a16253e39..885ce0857b 100644 --- a/src/lib-ssl-iostream/istream-openssl.c +++ b/src/lib-ssl-iostream/istream-openssl.c @@ -24,6 +24,7 @@ static void i_stream_ssl_destroy(struct iostream_private *stream) struct ssl_istream *sstream = (struct ssl_istream *)stream; i_free(sstream->istream.w_buffer); + sstream->ssl_io->ssl_input = NULL; ssl_iostream_unref(&sstream->ssl_io); } -- 2.47.3