Report failure on mutex timeout in discoverServices

Previously, a mutex timeout left characteristic caches empty but
still signalled success to callers, making all GATT ops silently
fail for the connection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
torlando-tech
2026-03-05 11:46:43 -05:00
parent 8c0dd227f4
commit d9883c9e36

View File

@@ -1509,6 +1509,14 @@ bool NimBLEPlatform::discoverServices(uint16_t conn_handle) {
}
}
xSemaphoreGive(_conn_mutex);
} else {
WARNING("NimBLEPlatform::discoverServices: mutex timeout, handle=" +
std::to_string(conn_handle));
if (_on_services_discovered) {
ConnectionHandle conn = getConnection(conn_handle);
_on_services_discovered(conn, false);
}
return false;
}
DEBUG("NimBLEPlatform: Services discovered for " + std::to_string(conn_handle));