Skip to content

Commit 5bf8929

Browse files
fix indexing
1 parent 1c87d31 commit 5bf8929

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/source/PalGapImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,13 @@ ble_error_t PalGap::cancel_connection_creation(
326326
peer_address_type_t peerAddressType,
327327
const ble::address_t &peerAddress
328328
) {
329-
for (uint8_t connection_id = 1; connection_id <= DM_CONN_MAX; connection_id++) {
329+
for (uint8_t connection_id = 0; connection_id < DM_CONN_MAX; connection_id++) {
330330
if (dmConnCb.ccb[connection_id].inUse &&
331331
dmConnCb.ccb[connection_id].state == DM_CONN_SM_ST_CONNECTING &&
332332
BdaCmp(dmConnCb.ccb[connection_id].peerAddr, peerAddress.data())) {
333333
DmConnClose(
334334
DM_CLIENT_ID_APP,
335-
/* connection handle */ connection_id,
335+
/* connection handle */ connection_id + 1 /* connection IDs start at 1 */,
336336
/* reason - invalid (use success) */ 0x00
337337
);
338338
return BLE_ERROR_NONE;

0 commit comments

Comments
 (0)