small bugfix with flushing behavior

This commit is contained in:
Noah Laptop 2019-08-14 11:00:19 -07:00
parent 5e1a3b41ca
commit c6ac76be27

View file

@ -219,10 +219,8 @@ int SSLClientImpl::peek_impl() {
/* see SSLClientImpl.h */ /* see SSLClientImpl.h */
void SSLClientImpl::flush_impl() { void SSLClientImpl::flush_impl() {
// trigger a flush, incase there's any leftover data if (m_write_idx > 0)
br_ssl_engine_flush(&m_sslctx.eng, 0); if(m_run_until(BR_SSL_RECVAPP) < 0) m_error("Could not flush write buffer!", __func__);
// run until application data is ready for pickup
if(m_run_until(BR_SSL_RECVAPP) < 0) m_error("Could not flush write buffer!", __func__);
} }
/* see SSLClientImpl.h */ /* see SSLClientImpl.h */
@ -524,6 +522,8 @@ unsigned SSLClientImpl::m_update_engine() {
// data has been written to the io buffer, something is wrong // data has been written to the io buffer, something is wrong
if (!(state & BR_SSL_SENDAPP)) { if (!(state & BR_SSL_SENDAPP)) {
m_error("Error m_write_idx > 0 but the ssl engine is not ready for data", func_name); m_error("Error m_write_idx > 0 but the ssl engine is not ready for data", func_name);
m_error(br_ssl_engine_current_state(&m_sslctx.eng), func_name);
m_error(br_ssl_engine_last_error(&m_sslctx.eng), func_name);
setWriteError(SSL_BR_WRITE_ERROR); setWriteError(SSL_BR_WRITE_ERROR);
stop_impl(); stop_impl();
return 0; return 0;