Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e7f605d

Browse files
pi-anldpgeorge
authored andcommitted
aioble/device.py: Always create connection._event.
If the client disconnects immediately after connection, the irq can be run before the initial connect handler has finished.
1 parent f0b6832 commit e7f605d

File tree

1 file changed

+1
-4
lines changed
  • micropython/bluetooth/aioble/aioble

1 file changed

+1
-4
lines changed

‎micropython/bluetooth/aioble/aioble/device.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def __init__(self, device):
164164

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

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

209209
def _run_task(self):
210-
# Event will be already created this if we initiated connection.
211-
self._event = self._event or asyncio.ThreadSafeFlag()
212-
213210
self._task = asyncio.create_task(self.device_task())
214211

215212
async def disconnect(self, timeout_ms=2000):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /