From ebea0372014cb202f3b8645ccda7ff3987253fa9 Mon Sep 17 00:00:00 2001 From: Ian Craggs Date: Wed, 18 Feb 2026 17:54:26 +0000 Subject: [PATCH] Call send_connect when SSLSocket_connect succeeds #1607 --- src/MQTTProtocolOut.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MQTTProtocolOut.c b/src/MQTTProtocolOut.c index 5dfde4e9..9131bdba 100644 --- a/src/MQTTProtocolOut.c +++ b/src/MQTTProtocolOut.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2024 IBM Corp., Ian Craggs and others + * Copyright (c) 2009, 2026 IBM Corp., Ian Craggs and others * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 @@ -296,11 +296,15 @@ int MQTTProtocol_connect(const char* address, Clients* aClient, int unixsock, in } if (rc == 0 && SSLSocket_setSocketForSSL(&aClient->net, aClient->sslopts, address, addr_len) == 1) { - rc = aClient->sslopts->struct_version >= 3 ? + int sslrc = aClient->sslopts->struct_version >= 3 ? SSLSocket_connect(aClient->net.ssl, aClient->net.socket, address, aClient->sslopts->verify, aClient->sslopts->ssl_error_cb, aClient->sslopts->ssl_error_context) : SSLSocket_connect(aClient->net.ssl, aClient->net.socket, address, aClient->sslopts->verify, NULL, NULL); + if (sslrc == 1) /* success */ + rc = 0; + else if (sslrc < 0) + rc = sslrc; if (rc == TCPSOCKET_INTERRUPTED) aClient->connect_state = SSL_IN_PROGRESS; /* SSL connect called - wait for completion */ }