From 620c135ac454050d59c2b7b323d3a51cd6bd84dd Mon Sep 17 00:00:00 2001 From: Gilles Boccon-Gibod Date: Mon, 3 Apr 2023 17:52:51 -0700 Subject: [PATCH] only instantiate keystore if not already set --- apps/gg_bridge.py | 3 +-- bumble/device.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/gg_bridge.py b/apps/gg_bridge.py index 6506f7b..88ebdc5 100644 --- a/apps/gg_bridge.py +++ b/apps/gg_bridge.py @@ -339,8 +339,7 @@ async def run( # Create a UDP to TX bridge (receive from TX, send to UDP) bridge.tx_socket, _ = await loop.create_datagram_endpoint( - # pylint: disable-next=unnecessary-lambda - lambda: asyncio.DatagramProtocol(), + asyncio.DatagramProtocol, remote_addr=(send_host, send_port), ) diff --git a/bumble/device.py b/bumble/device.py index 7add5a1..843d78f 100644 --- a/bumble/device.py +++ b/bumble/device.py @@ -1179,7 +1179,8 @@ class Device(CompositeEventEmitter): # Instantiate the Key Store (we do this here rather than at __init__ time # because some Key Store implementations use the public address as a namespace) - self.keystore = KeyStore.create_for_device(self) + if self.keystore is None: + self.keystore = KeyStore.create_for_device(self) if self.host.supports_command(HCI_WRITE_LE_HOST_SUPPORT_COMMAND): await self.send_command(