added extra write flush and debugging

This commit is contained in:
Noah Laptop 2019-06-11 17:02:42 -07:00
parent 75bc956a8e
commit ae19c5a081

View file

@ -229,6 +229,7 @@ void SSLClientImpl::flush_impl() {
/* see SSLClientImpl.h */ /* see SSLClientImpl.h */
void SSLClientImpl::stop_impl() { void SSLClientImpl::stop_impl() {
const char* func_name = __func__;
// tell the SSL connection to gracefully close // tell the SSL connection to gracefully close
br_ssl_engine_close(&m_sslctx.eng); br_ssl_engine_close(&m_sslctx.eng);
// if the engine isn't closed, and the socket is still open // if the engine isn't closed, and the socket is still open
@ -245,6 +246,13 @@ void SSLClientImpl::stop_impl() {
} }
} }
// close the ethernet socket // close the ethernet socket
get_arduino_client().flush();
// clear the intake buffer, if any
const auto avail = get_arduino_client().available();
if (avail > 0) {
m_info("Flushing bytes from client: ", func_name);
get_arduino_client().read(NULL, avail);
}
get_arduino_client().stop(); get_arduino_client().stop();
// we are no longer connected // we are no longer connected
m_is_connected = false; m_is_connected = false;