-
Notifications
You must be signed in to change notification settings - Fork 161
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
Revert the change for reseting service data on non scan hci events #297
Revert the change for reseting service data on non scan hci events #297
Conversation
…ow reset every non scan response event
@kele6ra ... please have a look too. Your PR introduced the issue. Please advice. |
Hello, I can't understand what you have changed. Because we have:
And you haven't changed logic. Maybe in another file, but not in the gap.js. |
@kele6ra 👋 the hasScanResponse is already set true above it: Lines 131 to 133 in 67e3936
So in case we receive an event 0x04 (scan) and then 0x01 the serviceData array is not reset cause because of hasScanResponse is then true. One can reproduce this with the test that I added, if we rely on the hasScanResponse the test shows that the serviceData array just keeps growing on new events 🤔 flowchart TD
event1[Event 0x04] --> advertisement1[This peripheral is now previously discovered and its hasScanResponse is true]
advertisement1 --> event2[Some other event received]
event2--> nextStep[The service data should be reset, but it's not as hasScanResponse is true as this is discovered already]
nextStep--> loop[This loops and service data just gets appended]
It looks like this in real life:
But reverting this logic to rely just on the event seems to fix this |
Sorry, but I can't check it now. |
I will also look into the PR later today hopefully ... but seems legit to me - and yes the ever growing servicedata is a bad bug right noe ... @rzr release work incoming ;-)) |
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
See the background discussion and logs what are happening here: #296
This commit b67eea2 changed the logic where the service data is reset from the meta event type scan to ever having a scan response discovered, and so leading to ever growing serviceData arrays in advertisements.
I reverted the logic to the one that was existing before this commit and introduced a test for catching the problem. I'm not so familiar with this codebase so this could use a another pair of eyes too 😅.