From c089eab59548d9eba02e4b4f8c3ac84c237ab1d1 Mon Sep 17 00:00:00 2001 From: h2zero Date: Thu, 14 Jan 2021 10:21:25 -0700 Subject: [PATCH] Check connection status when returning in NimBLEClient::Connect. There is a chance to become disconnected before returning from the onConnect callback so the connection status should be checked when returning from client connect. --- src/NimBLEClient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NimBLEClient.cpp b/src/NimBLEClient.cpp index b0e2795..70dfc7c 100644 --- a/src/NimBLEClient.cpp +++ b/src/NimBLEClient.cpp @@ -284,7 +284,8 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) { m_pClientCallbacks->onConnect(this); NIMBLE_LOGD(LOG_TAG, "<< connect()"); - return true; + // Check if still connected before returning + return isConnected(); } // connect