Skip to content

Find client by handle during disconnect event.#365

Merged
h2zero merged 1 commit into
h2zero:masterfrom
gkoh:master
Oct 23, 2025
Merged

Find client by handle during disconnect event.#365
h2zero merged 1 commit into
h2zero:masterfrom
gkoh:master

Conversation

@gkoh

@gkoh gkoh commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Rather than searching the client list by connection address, search by connection handle.
This avoids an issue where the target device has RPA enabled and addresses will not match.

Additionally, update the client peer address with the ID address when the identity has been resolved.

@gkoh

gkoh commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

This attempts to address #360.

I have only tested the getClientByHandle() change.

I have not tested the setPeerAddress() call after identity resolve, yet.

@gkoh

gkoh commented Sep 11, 2025

Copy link
Copy Markdown
Contributor Author

This needs more thought.
I have just realised this half reverts the onConnectFail() fixes in 8cefc0a

@gkoh

gkoh commented Sep 11, 2025

Copy link
Copy Markdown
Contributor Author

This PR went from half baked to totally unbaked 🙁
Upon testing the setPeerAddress() change, I got the very helpful:

E NimBLEClient: Cannot set peer address while connected

so, that isn't going to work either.

At this point, I think the right answer is to just add getClientByHandle() to the end of the search by addresses.
So:

  • search by ota_addr
  • search by id_addr
  • search by conn_handle

If the peer has RPA enabled, searching by address fails due to address
resolution.
If this occurs, attempt to find the client by connection handle.
@gkoh

gkoh commented Sep 12, 2025

Copy link
Copy Markdown
Contributor Author

Updated to add search by connection handle after search by address fails.

@h2zero

h2zero commented Oct 23, 2025

Copy link
Copy Markdown
Owner

Awesome, thanks @gkoh

@h2zero h2zero merged commit d163a9f into h2zero:master Oct 23, 2025
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants