mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-21 12:40:54 +01:00
Fix NimBLEClient::secureConnection incorrectly failing with BLE_HS_EAGAIN.
This commit is contained in:
parent
020c61700d
commit
7d0636bc91
2 changed files with 3 additions and 4 deletions
|
@ -302,9 +302,8 @@ bool NimBLEClient::secureConnection() const {
|
|||
do {
|
||||
m_pTaskData = &taskData;
|
||||
|
||||
int rc = NimBLEDevice::startSecurity(m_connHandle);
|
||||
if (rc != 0 && rc != BLE_HS_EALREADY) {
|
||||
m_lastErr = rc;
|
||||
if (!NimBLEDevice::startSecurity(m_connHandle)) {
|
||||
m_lastErr = BLE_HS_ENOTCONN;
|
||||
m_pTaskData = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1127,7 +1127,7 @@ bool NimBLEDevice::startSecurity(uint16_t connHandle) {
|
|||
NIMBLE_LOGE(LOG_TAG, "ble_gap_security_initiate: rc=%d %s", rc, NimBLEUtils::returnCodeToString(rc));
|
||||
}
|
||||
|
||||
return rc == 0;
|
||||
return rc == 0 || rc == BLE_HS_EALREADY;
|
||||
} // startSecurity
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue