Closed Bug 974872 Opened 10 years ago Closed 10 years ago

[Bluetooth] Signal success or failure at the end of start/stop process

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tzimmermann, Assigned: tzimmermann)

References

Details

The bug description has been taken from Bug 972253, comment #6.

Right now we need to set and clear sDBusConnection in {Start|Stop}Internal because of the reply that is signaled after these methods return. So we should move the reply to the end of each process (i.e. StartDBusConnectionTask and DeleteDBusConnection) and re-factor the functionality as follows:

 Starting:
   - setup Bluedroid and DBus connection in StartInternal (BT thread)
   - set sDBusConnection and start watching in StartDbusConnectionTask::Run (I/O thread)
   - signal success

 Stopping:
   - clear gDBusConnection (I/O)
   - clean up connection (BT)
   - delete connection in DeleteDBusConnetion::Run (I/O)
   - close Bluedroid (BT)
   - signal success

Stopping is ugly. There is no good way for telling DBus to stop watching a connection. This means that a connection can still receive DBus replies while being shut down. This seems to work right now because some of the code handles this case explicitly. The only way to fully protect us from racy shutdowns is to run the cleanup on the I/O thread. But there are calls to dbus_bus_remove_match [1] in StopInternal. These calls block if we want them to report errors. The other DBus calls should be fine. I'd suggest to remove error reporting from dbus_bus_remove_match and collapse steps 1 to 3 into one, which can run on the I/O thread.
Depends on: 977146
Depends on: 978809
Depends on: 979370
Depends on: 983576
The final patch landed with bug 983576.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.