-
Notifications
You must be signed in to change notification settings - Fork 8.2k
bluetooth: host: Add flag to prevent client resubscription on reconnect #20903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bluetooth: host: Add flag to prevent client resubscription on reconnect #20903
Conversation
Vudentz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that this is configurable via Kconfig which should probably default to no if we want to keep current behavior, or perhaps default to yes instead since this was done to deal with misbehaving devices.
The current way of resubscribing after reconnection is a workaround for the gatt servers that do not persist subscription information. I preferred the flag approach as we may need to deal with both types of gatt servers (those that persist and those that do not). The application can then give the appropriate flag to bt_gatt_subscribe given the type of peer device it connects with. |
|
Do we know when this workaround is needed? This seems to expose a workaround as a feature at the API level. I think this should have a better description of what this option is if the application should have the responsibility to apply the workaround. |
The previous workaround is needed if we know the device we subscribe to (gatt server) does not save/persist subscription data. In that case we should resubscribe every time we reconnect to it just in case. This flag adds the option to not resubscribe on reconnect. |
That I understand. It's not what I'm wondering about. With this PR you are giving the application the option to not resubscribe on reconnect dynamically. |
In our case the application can query the device type from GATT characteristics to know if it persists subscriptions. Also if one wants to write a test to verify that persistence actually works (in that case the test application knows in advance that the peer device should persist), it would be nice to have the option to not resubscribe immediately when reconnecting. |
|
@fnde-ot I have no objection to adding this flag. I just think it should be explained in the header file that it is to disable the workaround. That can give the application a better overview of why this would be needed. |
When set, the BT_GATT_SUBSCRIBE_FLAG_NO_RESUB flag indicates that the subscription should not be renewed when reconnecting with the server. This is useful if the application layer knows that the GATT server persists subscription information. Signed-off-by: François Delawarde <[email protected]>
Of course! Latest push improves the description in the header file. |
006a04f to
fd45b04
Compare
joerchan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. That is a very clear description.
@Vudentz I'd prefer not to change the default behaviour
Vudentz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Id would have it the other way around but there could be code depending on the resubscription logic.
When set, the BT_GATT_SUBSCRIBE_FLAG_NO_RESUB flag indicates that the
subscription should not be renewed when reconnecting with the server.
This is useful if the application layer knows that the GATT server
persists subscription information.
Signed-off-by: François Delawarde [email protected]