Bug 805724 - patch 1: made BluetoothOppManager listen again after disconnection, r=qdot

This commit is contained in:
Eric Chou 2012-11-03 09:36:19 +08:00
parent d99a8a8cca
commit 6c0d16f800
2 changed files with 13 additions and 0 deletions

View File

@ -162,6 +162,7 @@ BluetoothOppManager::BluetoothOppManager() : mConnected(false)
, mWaitingForConfirmationFlag(false)
{
mConnectedDeviceAddress.AssignLiteral("00:00:00:00:00:00");
mSocketStatus = GetConnectionStatus();
}
BluetoothOppManager::~BluetoothOppManager()
@ -244,6 +245,8 @@ BluetoothOppManager::Listen()
true,
true,
this);
mSocketStatus = GetConnectionStatus();
return NS_FAILED(rv) ? false : true;
}
@ -960,11 +963,16 @@ BluetoothOppManager::OnConnectSuccess()
// Cache device address since we can't get socket address when a remote
// device disconnect with us.
GetSocketAddr(mConnectedDeviceAddress);
mSocketStatus = GetConnectionStatus();
}
void
BluetoothOppManager::OnConnectError()
{
CloseSocket();
mSocketStatus = GetConnectionStatus();
Listen();
}
void
@ -974,4 +982,8 @@ BluetoothOppManager::OnDisconnect()
// closing socket without sending OBEX disconnect request first. So we
// call AfterOppDisconnected here to ensure all variables will be cleaned.
AfterOppDisconnected();
if (mSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
Listen();
}
}

View File

@ -107,6 +107,7 @@ private:
bool mPutFinal;
bool mWaitingForConfirmationFlag;
int mUpdateProgressCounter;
enum mozilla::ipc::SocketConnectionStatus mSocketStatus;
nsCOMPtr<nsIDOMBlob> mBlob;
nsCOMPtr<nsIThread> mReadFileThread;