Skip to content
Permalink
Browse files

bluetooth: fix GATT database hash done too many times

Submit GATT database hash as a delayed work to prevent it being run
twice if we register dynamic services.

Signed-off-by: François Delawarde <fnde@oticon.com>
  • Loading branch information...
fnde-ot authored and aescolar committed Jul 11, 2019
1 parent c429051 commit 88a2fb87acaeae71150be91890b30e430c94922f
Showing with 6 additions and 3 deletions.
  1. +6 −3 subsys/bluetooth/host/gatt.c
@@ -739,12 +739,15 @@ void bt_gatt_init(void)
last_static_handle += svc->attr_count;
}

#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
#if defined(CONFIG_BT_GATT_CACHING)
k_delayed_work_init(&db_hash_work, db_hash_process);
db_hash_gen(false);
#endif /* COFNIG_BT_GATT_CACHING */

/* Submit work to Generate initial hash as there could be static
* services already in the database.
*/
k_delayed_work_submit(&db_hash_work, DB_HASH_TIMEOUT);
#endif /* CONFIG_BT_GATT_CACHING */
#if defined(CONFIG_BT_GATT_DYNAMIC_DB)
k_delayed_work_init(&gatt_sc.work, sc_process);
#endif /* CONFIG_BT_GATT_DYNAMIC_DB */
#if defined(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE)

0 comments on commit 88a2fb8

Please sign in to comment.
You can’t perform that action at this time.