Skip to content

aioble/peripheral: Handle immediate disconnect. #471

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

Merged
merged 1 commit into from
May 24, 2024

Conversation

andrewleech
Copy link
Contributor

If the client disconnects immediately after connection, the irq can be run before the initial connect handler has finished.

@puppet13th
Copy link

+1

@jimmo
Copy link
Member

jimmo commented Sep 2, 2022

Thanks @andrewleech

I think maybe this could just be simplified by having DeviceConnection::__init__ always unconditionally create the event. I'm not sure I can see any code paths now that don't end up initialising self._event anyway. i.e. construction of a DeviceConnection for either a central or a peripheral will always end up needing to initialise the event. So we'll always have to do this allocation regardless, might as well do it up-front.

Then we can get rid of all the various places that create-or-reuse the event...less code overall.

If the client disconnects immediately after connection, the irq can be run
before the initial connect handler has finished.
@dpgeorge dpgeorge force-pushed the peripheral_disconnect branch from 1c36e08 to e7f605d Compare May 24, 2024 09:04
@dpgeorge dpgeorge merged commit e7f605d into micropython:master May 24, 2024
2 of 3 checks passed
@andrewleech andrewleech deleted the peripheral_disconnect branch September 6, 2024 03:40
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.

5 participants