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-06 10:00:02 +02:00
Родитель 48eb012ef4
Коммит 362da7534b
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -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;