MYNEWT-702 BLE Host - duplicate update entries

Fix similar issue for L2CAP updates.

X-Original-Commit: e33dbd45aa2de1209ef36d2cc0cf7016d97f2828
This commit is contained in:
Christopher Collins
2017-04-03 18:29:15 -07:00
parent 2b2ee093a9
commit 88b726db8d
2 changed files with 13 additions and 2 deletions
+4 -2
View File
@@ -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();
+9
View File
@@ -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;