mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-21 20:27:55 +00:00
MYNEWT-702 BLE Host - duplicate update entries
Fix similar issue for L2CAP updates. X-Original-Commit: e33dbd45aa2de1209ef36d2cc0cf7016d97f2828
This commit is contained in:
@@ -2620,6 +2620,9 @@ ble_gap_update_entry_free(struct ble_gap_update_entry *entry)
|
||||
int rc;
|
||||
|
||||
if (entry != NULL) {
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
memset(entry, 0xff, sizeof *entry);
|
||||
#endif
|
||||
rc = os_memblock_put(&ble_gap_update_entry_pool, entry);
|
||||
BLE_HS_DBG_ASSERT_EVAL(rc == 0);
|
||||
}
|
||||
@@ -2928,8 +2931,6 @@ done:
|
||||
if (rc == 0) {
|
||||
ble_hs_timer_resched();
|
||||
} else {
|
||||
ble_gap_update_entry_free(entry);
|
||||
|
||||
/* If the l2cap_params struct is populated, the only error is that the
|
||||
* controller doesn't support the connection parameters request
|
||||
* procedure. In this case, fallback to the L2CAP update procedure.
|
||||
@@ -2945,6 +2946,7 @@ done:
|
||||
if (rc == 0) {
|
||||
SLIST_INSERT_HEAD(&ble_gap_update_entries, entry, next);
|
||||
} else {
|
||||
ble_gap_update_entry_free(entry);
|
||||
STATS_INC(ble_gap_stats, update_fail);
|
||||
}
|
||||
ble_hs_unlock();
|
||||
|
||||
@@ -1854,6 +1854,15 @@ ble_gap_test_util_update_l2cap(struct ble_gap_upd_params *params,
|
||||
|
||||
TEST_ASSERT(ble_gap_dbg_update_active(2));
|
||||
|
||||
/* Attempt two duplicate updates; ensure BLE_HS_EALREADY gets returned
|
||||
* both times. Make sure initial update still completes successfully
|
||||
* (MYNEWT-702).
|
||||
*/
|
||||
rc = ble_hs_test_util_conn_update(2, params, 0);
|
||||
TEST_ASSERT(rc == BLE_HS_EALREADY);
|
||||
rc = ble_hs_test_util_conn_update(2, params, 0);
|
||||
TEST_ASSERT(rc == BLE_HS_EALREADY);
|
||||
|
||||
l2cap_params.itvl_min = params->itvl_min;
|
||||
l2cap_params.itvl_max = params->itvl_max;
|
||||
l2cap_params.slave_latency = params->latency;
|
||||
|
||||
Reference in New Issue
Block a user