OSDN Git Service

Fix service classes race condition upon starting bluetoothd
authorJohan Hedberg <johan.hedberg@nokia.com>
Wed, 6 May 2009 13:11:49 +0000 (16:11 +0300)
committerJohan Hedberg <johan.hedberg@nokia.com>
Wed, 6 May 2009 13:13:59 +0000 (16:13 +0300)
During initial startup if InitiallyPowered=false we might not get the
"write class of device complete" HCI event before bluetoothd puts the
adapter DOWN. In this case the correct class never gets written to storage
but stays in adapter->svc_cache instead. This patch makes sure that the
right class is always set in adapter_up().

src/adapter.c

index aad51e3..65ac36a 100644 (file)
@@ -2082,11 +2082,12 @@ proceed:
 
                adapter->initialized = TRUE;
 
-               adapter_update(adapter, 0, FALSE);
-
                manager_add_adapter(adapter->path);
        }
 
+       if (adapter->svc_cache)
+               adapter_update(adapter, 0, FALSE);
+
        if (dev_down) {
                adapter_ops->stop(adapter->dev_id);
                adapter->off_requested = TRUE;