From 7e88b987298c1efecd2cec79cc5261dc81c5e1b9 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 17 Aug 2021 11:28:07 +1000 Subject: [PATCH] aioble/server: Log warning on out-of-order indication. --- micropython/bluetooth/aioble/aioble/server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/micropython/bluetooth/aioble/aioble/server.py b/micropython/bluetooth/aioble/aioble/server.py index 5d5d7399b..7f30396f5 100644 --- a/micropython/bluetooth/aioble/aioble/server.py +++ b/micropython/bluetooth/aioble/aioble/server.py @@ -284,10 +284,11 @@ def _indicate_done(conn_handle, value_handle, status): # Timeout. return # See TODO in __init__ to support multiple concurrent indications. - assert connection == characteristic._indicate_connection - characteristic._indicate_status = status - characteristic._indicate_event.set() - + if connection == characteristic._indicate_connection: + characteristic._indicate_status = status + characteristic._indicate_event.set() + else: + log_warn("Received indication for unexpected connection") class BufferedCharacteristic(Characteristic): def __init__(self, *args, max_len=20, append=False, **kwargs):