esp-nimble-cpp icon indicating copy to clipboard operation
esp-nimble-cpp copied to clipboard

NimBLEClient::connect, when returning false, does not delete the client object when deleteOnConnectFail=true

Open dcodeIO opened this issue 8 months ago • 1 comments

During debugging, I somewhat randomly discovered that

pClient->setSelfDelete(true, true);
if (!pClient->connect(false, true, true)) {
  NimBLEDevice::deleteClient(pClient); // still needs to be called manually
}

when I was getting a number of clients exceeded log despite enabling self delete. Is this behaving correctly? In my case, technically, connect returns early, skipping the connection attempt, but semantically this wasn't obvious to me.

dcodeIO avatar May 20 '25 21:05 dcodeIO