From ef5c5c76445daf35eeaee5043674b37f98ff98d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Tue, 27 Feb 2024 16:18:01 +0100 Subject: [PATCH] Address feedback --- worker/src/RTC/DtlsTransport.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/worker/src/RTC/DtlsTransport.cpp b/worker/src/RTC/DtlsTransport.cpp index 0a8c8dedc9..f0e3e86c2e 100644 --- a/worker/src/RTC/DtlsTransport.cpp +++ b/worker/src/RTC/DtlsTransport.cpp @@ -63,7 +63,7 @@ inline static long onSslBioOut( // - First one with operationType = BIO_CB_WRITE. // - Second one with operationType = BIO_CB_RETURN | BIO_CB_WRITE. // We only care about the former. - if (operationType == BIO_CB_WRITE && argp && len > 0) + if ((operationType == BIO_CB_WRITE) && argp && len > 0) { auto* dtlsTransport = reinterpret_cast(BIO_get_callback_arg(bio)); @@ -1060,11 +1060,15 @@ namespace RTC // Clear the BIO buffer. // NOTE: Here we now that OpenSSL called the onSslBioOut() callback with - // with all the byte length that it previously wrote into the BIO mem - // buffer (this->sslBioToNetwork), so it's safe to clear the entire buffer - // after sending its entire DTLS data to the endpoint. - // NOTE: the (void) avoids the -Wunused-value warning. - (void)BIO_reset(this->sslBioToNetwork); + // all the byte length that it previously wrote into the BIO mem buffer + // (this->sslBioToNetwork), so it's safe to clear the entire buffer after + // sending its entire DTLS data to the endpoint. + auto ret = BIO_reset(this->sslBioToNetwork); + + if (ret != 1) + { + MS_ERROR("BIO_reset() failed [ret:%d]", ret); + } } void DtlsTransport::Reset() @@ -1110,10 +1114,9 @@ namespace RTC { MS_TRACE(); - int err; const bool wasHandshakeDone = this->handshakeDone; - err = SSL_get_error(this->ssl, returnCode); + int err = SSL_get_error(this->ssl, returnCode); switch (err) {