Don't fail hard when device disconnection fails.

This commit is contained in:
Fabio Manganiello 2023-03-19 12:56:53 +01:00
parent 40f81b105f
commit 12096f2dbe
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -180,7 +180,13 @@ class LegacyManager(BaseBluetoothManager):
# Close the connection once the context is over
with self._connection_locks[conn.key]:
conn.close()
try:
conn.close()
except Exception as e:
self.logger.warning(
'Error while closing the connection to %s: %s', device, e
)
self._connections.pop(conn.key, None)
dev.connected = False