Bug 816859 - Patch 1: Failed to receive a file, r=echou

This commit is contained in:
Gina Yeh 2012-11-30 17:49:08 +08:00
parent bbc00dbb68
commit b078ecf2ae

View File

@ -333,6 +333,7 @@ BluetoothOppManager::SendFile(BlobParent* aActor)
}
SendConnectRequest();
mTransferMode = false;
return true;
}
@ -379,6 +380,7 @@ BluetoothOppManager::AfterOppConnected()
sSentFileLength = 0;
mReceivedDataBufferOffset = 0;
mAbortFlag = false;
mSuccessFlag = false;
mWaitingForConfirmationFlag = true;
}
@ -391,6 +393,10 @@ BluetoothOppManager::AfterOppDisconnected()
mLastCommand = 0;
mBlob = nullptr;
// We can't reset mSuccessFlag here since this function may be called
// before we send system message of transfer complete
// mSuccessFlag = false;
if (mInputStream) {
mInputStream->Close();
mInputStream = nullptr;
@ -608,8 +614,6 @@ BluetoothOppManager::ReceiveSocketData(UnixSocketRawData* aMessage)
SendDisconnectRequest();
} else {
// Remote request or unknown mLastCommand
mTransferMode = true;
mSuccessFlag = false;
ObexHeaderSet pktHeaders(opCode);
if (opCode == ObexRequestCode::Connect) {
@ -621,6 +625,7 @@ BluetoothOppManager::ReceiveSocketData(UnixSocketRawData* aMessage)
&pktHeaders);
ReplyToConnect();
AfterOppConnected();
mTransferMode = true;
} else if (opCode == ObexRequestCode::Disconnect) {
// Section 3.3.2 "Disconnect", IrOBEX 1.2
// [opcode:1][length:2][Headers:var]
@ -739,8 +744,6 @@ BluetoothOppManager::SendConnectRequest()
index += AppendHeaderConnectionId(&req[index], mConnectionId);
SetObexPacketInfo(req, ObexRequestCode::Connect, index);
mLastCommand = ObexRequestCode::Connect;
mTransferMode = false;
mSuccessFlag = false;
UnixSocketRawData* s = new UnixSocketRawData(index);
memcpy(s->mData, req, s->mSize);
@ -1109,4 +1112,5 @@ BluetoothOppManager::OnDisconnect()
// call AfterOppDisconnected here to ensure all variables will be cleaned.
AfterOppDisconnected();
mConnectedDeviceAddress.AssignLiteral("00:00:00:00:00:00");
mSuccessFlag = false;
}