Nordic BLE:

Cancel pairing if the device fail to allocate the resources necessary for the pairing operation.
pull/7210/head
Vincent Coubard 2018-06-13 15:11:13 +01:00
parent f0c3f14887
commit 5237c3ec40
2 changed files with 6 additions and 0 deletions

View File

@ -300,6 +300,9 @@ ble_error_t nRF5xSecurityManager::send_pairing_response(
) {
pairing_control_block_t* pairing_cb = allocate_pairing_cb(connection);
if (!pairing_cb) {
// not enough memory; try to reject the pairing request instead of
// waiting for timeout.
cancel_pairing(connection, pairing_failure_t::UNSPECIFIED_REASON);
return BLE_ERROR_NO_MEM;
}
pairing_cb->role = PAIRING_RESPONDER;

View File

@ -277,6 +277,9 @@ ble_error_t nRF5xSecurityManager::send_pairing_response(
) {
pairing_control_block_t* pairing_cb = allocate_pairing_cb(connection);
if (!pairing_cb) {
// not enough memory; try to reject the pairing request instead of
// waiting for timeout.
cancel_pairing(connection, pairing_failure_t::UNSPECIFIED_REASON);
return BLE_ERROR_NO_MEM;
}
pairing_cb->role = PAIRING_RESPONDER;