Bug 1037342: Close file descriptor in BluetoothSocket (under bluetooth2/), r=btian
authorThomas Zimmermann <tdz@users.sourceforge.net>
Thu, 17 Jul 2014 09:44:19 +0200
changeset 216533 5ed8045dab5057bc97c915934806b1606f6a3188
parent 216532 6e36501f2ddd630cf140b21c5f6aecd60ae2bf3e
child 216534 5c83d0b682ac8f09809b5ebf4786d880d29273bc
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbtian
bugs1037342
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1037342: Close file descriptor in BluetoothSocket (under bluetooth2/), r=btian Currently, BluetoothSocket leaks its file descriptor on close operations. With this patch when Gecko closes an instance of BluetoothSocket, the file descriptor is now closed as well.
dom/bluetooth2/bluedroid/BluetoothSocket.cpp
--- a/dom/bluetooth2/bluedroid/BluetoothSocket.cpp
+++ b/dom/bluetooth2/bluedroid/BluetoothSocket.cpp
@@ -140,18 +140,17 @@ public:
     mConsumer = nullptr;
   }
 
   void ShutdownOnIOThread()
   {
     MOZ_ASSERT(!NS_IsMainThread());
     MOZ_ASSERT(!mShuttingDownOnIOThread);
 
-    RemoveWatchers(READ_WATCHER | WRITE_WATCHER);
-
+    Close(); // will also remove fd from I/O loop
     mShuttingDownOnIOThread = true;
   }
 
   void Connect(int aFd);
   void Listen(int aFd);
   void Accept(int aFd);
 
   void ConnectClientFd()