bluetooth: gatt: Fix storing subscriptions

Change fixes storing subscriptions in settings. CCC write can interrupt
the ccc_delayed_store. Without the change, new CCC was not stored in
non-volatile memory and the work that stored CCC was not resubmitted.
That resulted in lost subscription after reboot.

Fixes: #26862

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
This commit is contained in:
Marek Pieta 2020-07-15 00:56:57 -07:00 committed by Carles Cufí
commit a6e8cf4374

View file

@ -992,9 +992,9 @@ static void ccc_delayed_store(struct k_work *work)
} }
if (bt_addr_le_is_bonded(conn->id, &conn->le.dst)) { if (bt_addr_le_is_bonded(conn->id, &conn->le.dst)) {
ccc_store->conn_list[i] = NULL;
bt_gatt_store_ccc(conn->id, &conn->le.dst); bt_gatt_store_ccc(conn->id, &conn->le.dst);
bt_conn_unref(conn); bt_conn_unref(conn);
ccc_store->conn_list[i] = NULL;
} }
} }
} }