Skip to content
Commit 1d367347 authored by Arthur Crepin-Leblond's avatar Arthur Crepin-Leblond Committed by Anas Nashif
Browse files

Bluetooth: gatt: Reuse existing handles from a previously added service



When removing a service using bt_gatt_service_unregister, its attributes
handles will keep their value which can cause a problem when adding the
service again to the GATT database.
When re-adding, the gatt_register routine is taking the last handle of
the GATT database to compare it with the handles of the service to be
added.
If a service has handles with a lower value than the last handle of
the database an error will occur.
If we add/remove/add the last service, no error will occur as its
handles are always greater than the last one of the database.

Instead of resetting the handles when unregistering a service and
reassign new ones we make sure that the handles of the services are
not in use in the GATT database in order to place the service back
where it used to be.

Signed-off-by: default avatarArthur Crepin-Leblond <arthur.crepin@proglove.de>
parent 6cf806ac
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment