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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions micropython/bluetooth/aioble/aioble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def __init__(self, device):

# This event is fired by the IRQ both for connection and disconnection
# and controls the device_task.
self._event = None
self._event = asyncio.ThreadSafeFlag()

# If we're waiting for a pending MTU exchange.
self._mtu_event = None
Expand Down Expand Up @@ -207,9 +207,6 @@ async def device_task(self):
t._task.cancel()

def _run_task(self):
# Event will be already created this if we initiated connection.
self._event = self._event or asyncio.ThreadSafeFlag()

self._task = asyncio.create_task(self.device_task())

async def disconnect(self, timeout_ms=2000):
Expand Down
Loading