Bug 1161003: Don't send PDU when connection to Bluetooth daemon is closed, r=shuang

During restarts of the Bluetooth daemon, it can occur that Gecko tries
to send without having a connection to bluetoothd opened. This patch adds
a check to prevent this.
This commit is contained in:
Thomas Zimmermann 2015-05-05 17:02:43 +02:00
parent ba00d907df
commit 4f5dc0f157

View File

@ -1512,6 +1512,12 @@ BluetoothDaemonProtocol::Send(BluetoothDaemonPDU* aPDU, void* aUserData)
aPDU->SetConsumer(this);
aPDU->SetUserData(aUserData);
aPDU->UpdateHeader();
if (mConnection->GetConnectionStatus() == SOCKET_DISCONNECTED) {
BT_LOGR("Connection to Bluetooth daemon is closed.");
return NS_ERROR_FAILURE;
}
mConnection->SendSocketData(aPDU); // Forward PDU to command channel
return NS_OK;