Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Socket Close Hangs Indefinitely When There Is No Connectivity #909

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libraries/SocketWrapper/src/MbedClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ void arduino::MbedClient::stop() {
if (_own_socket) {
delete sock;
} else {
sock->set_timeout(_timeout);
sock->close();
}
sock = nullptr;
Expand Down
24 changes: 24 additions & 0 deletions patches/0230-TLSSocketWrapper-do-not-force-close-to-block.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From d0f5c17e3f7a3094c80b6b239c407f1cf7ba6df9 Mon Sep 17 00:00:00 2001
From: pennam <m.pennasilico@arduino.cc>
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

Loading