From a4f96de711870178d79dfede62a9a2f1a6adafb2 Mon Sep 17 00:00:00 2001 From: Chris Sutcliff Date: Mon, 19 Oct 2026 20:43:40 +0100 Subject: [PATCH] Close the socket in stop() when the connection is not secure --- src/client/SSLClient.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/SSLClient.h b/src/client/SSLClient.h index 2eb3360..fc7aba9 100644 --- a/src/client/SSLClient.h +++ b/src/client/SSLClient.h @@ -485,8 +485,13 @@ class BSSL_SSLClient : public Client void stop() override { + // Plain connection, or a TLS handshake that failed: there is no TLS session to close, but the socket is still open if (!_secure) + { + if (_basic_client) + _basic_client->stop(); return; + } // Only if we've already connected, store session params and clear the connection options if (_session)