diff --git a/src/ble/gatt_client.c b/src/ble/gatt_client.c index 2e2057c94..4c25b8d28 100644 --- a/src/ble/gatt_client.c +++ b/src/ble/gatt_client.c @@ -1229,8 +1229,7 @@ static void gatt_client_event_packet_handler(uint8_t packet_type, uint16_t chann gatt_client->reencryption_active = false; gatt_client->wait_for_authentication_complete = 0; - bool client_request_pending = gatt_client->gatt_client_state != P_READY; - if (!client_request_pending) break; + if (gatt_client->gatt_client_state == P_READY) break; switch (sm_event_reencryption_complete_get_status(packet)){ case ERROR_CODE_SUCCESS: @@ -1238,9 +1237,9 @@ static void gatt_client_event_packet_handler(uint8_t packet_type, uint16_t chann break; case ERROR_CODE_AUTHENTICATION_FAILURE: case ERROR_CODE_PIN_OR_KEY_MISSING: -#ifndef ENABLE_LE_PROACTIVE_AUTHENTICATION +#if defined(ENABLE_GATT_CLIENT_PAIRING) && !defined(ENABLE_LE_PROACTIVE_AUTHENTICATION) if (gatt_client_required_security_level == LEVEL_0) { - // re-encryption failed for reactive authentication and we have a pending client request + // re-encryption failed for reactive authentication with pairing and we have a pending client request // => try to resolve it by deleting bonding information if we started pairing before // delete bonding information int le_device_db_index = sm_le_device_index(gatt_client->con_handle);