author | Thomas Zimmermann <tdz@users.sourceforge.net> |
Wed, 01 Oct 2014 10:50:33 +0200 | |
changeset 211319 | 735159446aef0ce0e577e8e6a7d45e89304e08b5 |
parent 211318 | 082f8ad2c9e637cd448486c31c7925247a4bf462 |
child 211320 | 6ba401d05634088f7003f549e16752ea1c01ac2a |
push id | 50691 |
push user | kwierso@gmail.com |
push date | Tue, 21 Oct 2014 02:08:21 +0000 |
treeherder | mozilla-inbound@0808729b24e8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | shawnjohnjr |
bugs | 1074419 |
milestone | 36.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
|
--- a/dom/bluetooth/bluedroid/BluetoothSocket.cpp +++ b/dom/bluetooth/bluedroid/BluetoothSocket.cpp @@ -358,28 +358,31 @@ public: MOZ_ASSERT(mImpl); } void Accept(int aFd, const nsAString& aBdAddress, int aConnectionStatus) MOZ_OVERRIDE { MOZ_ASSERT(NS_IsMainThread()); + mozilla::ScopedClose fd(aFd); // Close received socket fd on error + if (mImpl->IsShutdownOnMainThread()) { BT_LOGD("mConsumer is null, aborting receive!"); return; } if (aConnectionStatus != 0) { mImpl->mConsumer->NotifyError(); return; } mImpl->mConsumer->SetAddress(aBdAddress); - XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new AcceptTask(mImpl, aFd)); + XRE_GetIOMessageLoop()->PostTask(FROM_HERE, + new AcceptTask(mImpl, fd.forget())); } void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE { MOZ_ASSERT(NS_IsMainThread()); BT_LOGR("BluetoothSocketInterface::Accept failed: %d", (int)aStatus); if (!mImpl->IsShutdownOnMainThread()) {
--- a/dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp @@ -4,16 +4,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "BluetoothSocketHALInterface.h" #include <errno.h> #include <unistd.h> #include <sys/socket.h> #include "BluetoothHALHelpers.h" +#include "mozilla/FileUtils.h" #include "nsClassHashtable.h" #include "nsXULAppAPI.h" BEGIN_BLUETOOTH_NAMESPACE typedef BluetoothHALInterfaceRunnable1<BluetoothSocketResultHandler, void, int, int> @@ -480,16 +481,20 @@ class AcceptWatcher MOZ_FINAL : public S { public: AcceptWatcher(int aFd, BluetoothSocketResultHandler* aRes) : SocketMessageWatcher(aFd, aRes) { } void Proceed(BluetoothStatus aStatus) MOZ_OVERRIDE { + if ((aStatus != STATUS_SUCCESS) && (GetClientFd() != -1)) { + mozilla::ScopedClose(GetClientFd()); // Close received socket fd on error + } + DispatchBluetoothSocketHALResult( GetResultHandler(), &BluetoothSocketResultHandler::Accept, GetClientFd(), GetBdAddress(), GetConnectionStatus(), aStatus); MessageLoopForIO::current()->PostTask( FROM_HERE, new DeleteTask<AcceptWatcher>(this)); } };
--- a/dom/bluetooth2/bluedroid/BluetoothSocket.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothSocket.cpp @@ -358,28 +358,31 @@ public: MOZ_ASSERT(mImpl); } void Accept(int aFd, const nsAString& aBdAddress, int aConnectionStatus) MOZ_OVERRIDE { MOZ_ASSERT(NS_IsMainThread()); + mozilla::ScopedClose fd(aFd); // Close received socket fd on error + if (mImpl->IsShutdownOnMainThread()) { BT_LOGD("mConsumer is null, aborting receive!"); return; } if (aConnectionStatus != 0) { mImpl->mConsumer->NotifyError(); return; } mImpl->mConsumer->SetAddress(aBdAddress); - XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new AcceptTask(mImpl, aFd)); + XRE_GetIOMessageLoop()->PostTask(FROM_HERE, + new AcceptTask(mImpl, fd.forget())); } void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE { MOZ_ASSERT(NS_IsMainThread()); BT_LOGR("BluetoothSocketInterface::Accept failed: %d", (int)aStatus); if (!mImpl->IsShutdownOnMainThread()) {
--- a/dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp @@ -4,16 +4,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "BluetoothSocketHALInterface.h" #include <errno.h> #include <sys/socket.h> #include <unistd.h> #include "BluetoothHALHelpers.h" +#include "mozilla/FileUtils.h" #include "nsClassHashtable.h" #include "nsXULAppAPI.h" BEGIN_BLUETOOTH_NAMESPACE typedef BluetoothHALInterfaceRunnable1<BluetoothSocketResultHandler, void, int, int> @@ -480,16 +481,20 @@ class AcceptWatcher MOZ_FINAL : public S { public: AcceptWatcher(int aFd, BluetoothSocketResultHandler* aRes) : SocketMessageWatcher(aFd, aRes) { } void Proceed(BluetoothStatus aStatus) MOZ_OVERRIDE { + if ((aStatus != STATUS_SUCCESS) && (GetClientFd() != -1)) { + mozilla::ScopedClose(GetClientFd()); // Close received socket fd on error + } + DispatchBluetoothSocketHALResult( GetResultHandler(), &BluetoothSocketResultHandler::Accept, GetClientFd(), GetBdAddress(), GetConnectionStatus(), aStatus); MessageLoopForIO::current()->PostTask( FROM_HERE, new DeleteTask<AcceptWatcher>(this)); } };