do not create more than one DBus object per bluetooth device

When the device is in pairing mode, it will send several properties
updates, and tuhi will attempt to create a second DBus object.

This is not good.
pull/14/head
Benjamin Tissoires 2018-01-19 10:02:48 +01:00 committed by Peter Hutterer
parent 4ee07a18b6
commit c79ffbd12c
1 changed files with 4 additions and 3 deletions

View File

@ -236,9 +236,10 @@ class Tuhi(GObject.Object):
return
if Tuhi._is_pairing_device(bluez_device):
tuhi_dbus_device = self.server.create_device(bluez_device, paired=False)
d = TuhiDevice(bluez_device, tuhi_dbus_device, self.config, paired=False)
self.devices[bluez_device.address] = d
if bluez_device.address not in self.devices:
tuhi_dbus_device = self.server.create_device(bluez_device, paired=False)
d = TuhiDevice(bluez_device, tuhi_dbus_device, self.config, paired=False)
self.devices[bluez_device.address] = d
logger.debug('{}: call Pair() on device'.format(bluez_device.objpath))