comparison src/lib-ssl-iostream/ostream-openssl.c @ 22843:f2d74b6dd754

lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() so that 1 is only returned when buffer is empty.
author Stephan Bosch <stephan.bosch@dovecot.fi>
date Fri, 09 Feb 2018 17:24:28 +0100
parents bf1a68547d67
children
comparison
equal deleted inserted replaced
22842:bf1a68547d67 22843:f2d74b6dd754
135 /* we need to read more data until we can continue. */ 135 /* we need to read more data until we can continue. */
136 o_stream_set_flush_pending(plain_output, FALSE); 136 o_stream_set_flush_pending(plain_output, FALSE);
137 sstream->ssl_io->ostream_flush_waiting_input = TRUE; 137 sstream->ssl_io->ostream_flush_waiting_input = TRUE;
138 ret = 1; 138 ret = 1;
139 } 139 }
140 return ret; 140
141 if (ret <= 0)
142 return ret;
143
144 /* return 1 only when the output buffer is empty, which is what the
145 caller expects. */
146 return o_stream_get_buffer_used_size(plain_output) == 0 ? 1 : 0;
141 } 147 }
142 148
143 static ssize_t 149 static ssize_t
144 o_stream_ssl_sendv(struct ostream_private *stream, 150 o_stream_ssl_sendv(struct ostream_private *stream,
145 const struct const_iovec *iov, unsigned int iov_count) 151 const struct const_iovec *iov, unsigned int iov_count)