Skip to content

Commit 1c36e08

Browse files
committed
aioble/device: Always create connection._event.
1 parent ad9309b commit 1c36e08

File tree

1 file changed

+1
-4
lines changed

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)