From cd5d1aa6017c620ae0c0abef75df9f8c1d257c28 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 27 Jun 2024 13:35:20 +0200 Subject: [PATCH 1/2] MbedClient: configure socket timeout before calling close() --- libraries/SocketWrapper/src/MbedClient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/SocketWrapper/src/MbedClient.cpp b/libraries/SocketWrapper/src/MbedClient.cpp index 2bb933350..b336b9b2c 100644 --- a/libraries/SocketWrapper/src/MbedClient.cpp +++ b/libraries/SocketWrapper/src/MbedClient.cpp @@ -280,6 +280,7 @@ void arduino::MbedClient::stop() { if (_own_socket) { delete sock; } else { + sock->set_timeout(_timeout); sock->close(); } sock = nullptr; From 5b31770f6ad481930cd3145e876e72ccf63783b2 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 27 Jun 2024 15:04:10 +0200 Subject: [PATCH 2/2] patches: TLSSocketWrapper do not force close to block --- ...tWrapper-do-not-force-close-to-block.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/0230-TLSSocketWrapper-do-not-force-close-to-block.patch diff --git a/patches/0230-TLSSocketWrapper-do-not-force-close-to-block.patch b/patches/0230-TLSSocketWrapper-do-not-force-close-to-block.patch new file mode 100644 index 000000000..33981a691 --- /dev/null +++ b/patches/0230-TLSSocketWrapper-do-not-force-close-to-block.patch @@ -0,0 +1,24 @@ +From d0f5c17e3f7a3094c80b6b239c407f1cf7ba6df9 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Thu, 27 Jun 2024 13:36:31 +0200 +Subject: [PATCH] TLSSocketWrapper: do not force close() to block + +--- + connectivity/netsocket/source/TLSSocketWrapper.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/connectivity/netsocket/source/TLSSocketWrapper.cpp b/connectivity/netsocket/source/TLSSocketWrapper.cpp +index 1fb9c21769..c020cd9f59 100644 +--- a/connectivity/netsocket/source/TLSSocketWrapper.cpp ++++ b/connectivity/netsocket/source/TLSSocketWrapper.cpp +@@ -757,7 +757,6 @@ nsapi_error_t TLSSocketWrapper::close() + + int ret = 0; + if (_handshake_completed) { +- _transport->set_blocking(true); + ret = mbedtls_ssl_close_notify(&_ssl); + if (ret) { + print_mbedtls_error("mbedtls_ssl_close_notify", ret); +-- +2.43.0 +