From ae19c5a0814f466c6770d6dc617cb5ac2e99cbec Mon Sep 17 00:00:00 2001 From: Noah Laptop Date: Tue, 11 Jun 2019 17:02:42 -0700 Subject: [PATCH] added extra write flush and debugging --- src/SSLClientImpl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SSLClientImpl.cpp b/src/SSLClientImpl.cpp index 130b11a..71f3cdb 100644 --- a/src/SSLClientImpl.cpp +++ b/src/SSLClientImpl.cpp @@ -229,6 +229,7 @@ void SSLClientImpl::flush_impl() { /* see SSLClientImpl.h */ void SSLClientImpl::stop_impl() { + const char* func_name = __func__; // tell the SSL connection to gracefully close br_ssl_engine_close(&m_sslctx.eng); // if the engine isn't closed, and the socket is still open @@ -245,6 +246,13 @@ void SSLClientImpl::stop_impl() { } } // 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(); // we are no longer connected m_is_connected = false;