Closed Bug 800247 Opened 7 years ago Closed 7 years ago

[b2g-bluetooth] User has no way of knowing when device disconnects.

Categories

(Core :: DOM: Device Interfaces, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla19
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: qdot, Assigned: qdot)

References

Details

Attachments

(1 file)

Repro:

1. Connect to paired, powered on device
2. Power off device

Expected:

Disconnection is relayed to gaia

Actual:

Gaia says still connected
Comment on attachment 670252 [details] [diff] [review]
Patch 1 (v1) - Add disconnect events to UnixSocket, update Bluetooth*Manager

cjones for unixsocket stuff, echou for manager stuff (not that there's much of it really)
Attachment #670252 - Flags: review?(echou)
Comment on attachment 670252 [details] [diff] [review]
Patch 1 (v1) - Add disconnect events to UnixSocket, update Bluetooth*Manager

Review of attachment 670252 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.
Attachment #670252 - Flags: review?(echou) → review+
Important UI consideration
blocking-basecamp: ? → +
Comment on attachment 670252 [details] [diff] [review]
Patch 1 (v1) - Add disconnect events to UnixSocket, update Bluetooth*Manager

>diff --git a/ipc/unixsocket/UnixSocket.cpp b/ipc/unixsocket/UnixSocket.cpp

>@@ -608,7 +632,8 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd)
>         mIncoming.forget();
>         mReadWatcher.StopWatchingFileDescriptor();
>         mWriteWatcher.StopWatchingFileDescriptor();
>-        mConsumer->CloseSocket();
>+        nsRefPtr<SocketCloseTask> t = new SocketCloseTask(this);
>+        NS_DispatchToMainThread(t);

It doesn't matter here, but a good habit to be in is to use

 NS_DispatchToMainThread(new SocketCloseTask(this));

to ensure that the destructor for your task runs on the main thread,
not accidentally on the dispatching thread.  (Note that you're holding
a strong ref here in the dispatcher.)

I can't tell you how much gnashing of teeth and rending of garments
I've seen from those kinds of bugs!  And I bet bent could tell you
even more great stories about those over beer sometime.
Attachment #670252 - Flags: review?(jones.chris.g) → review+
https://hg.mozilla.org/mozilla-central/rev/9d5627f5882b

Should this have a test?
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.