Bug 875650 - Shouldn't do the same thing when receiving ABORT and DISCONNECT, r=gyeh

The original implementation would be stuck on OPP server side after dealing with
ABORT packet. This is because we do something only should be done when receiving
DISCONNECT packet.
This commit is contained in:
Eric Chou 2013-05-24 15:59:32 +08:00
Родитель 45ec781eaa
Коммит 8d70ccdda9
2 изменённых файлов: 14 добавлений и 10 удалений

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

@ -710,19 +710,22 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
ReplyToConnect();
AfterOppConnected();
mIsServer = true;
} else if (opCode == ObexRequestCode::Disconnect ||
opCode == ObexRequestCode::Abort) {
// Section 3.3.2 "Disconnect", IrOBEX 1.2
} else if (opCode == ObexRequestCode::Abort) {
// Section 3.3.5 "Abort", IrOBEX 1.2
// [opcode:1][length:2][Headers:var]
ParseHeaders(&aMessage->mData[3],
receivedLength - 3,
&pktHeaders);
ReplyToDisconnect();
ReplyToDisconnectOrAbort();
DeleteReceivedFile();
} else if (opCode == ObexRequestCode::Disconnect) {
// Section 3.3.2 "Disconnect", IrOBEX 1.2
// [opcode:1][length:2][Headers:var]
ParseHeaders(&aMessage->mData[3],
receivedLength - 3,
&pktHeaders);
ReplyToDisconnectOrAbort();
AfterOppDisconnected();
if (opCode == ObexRequestCode::Abort) {
DeleteReceivedFile();
}
FileTransferComplete();
} else if (opCode == ObexRequestCode::Put ||
opCode == ObexRequestCode::PutFinal) {
@ -1143,11 +1146,12 @@ BluetoothOppManager::ReplyToConnect()
}
void
BluetoothOppManager::ReplyToDisconnect()
BluetoothOppManager::ReplyToDisconnectOrAbort()
{
if (!mConnected) return;
// Section 3.3.2 "Disconnect", IrOBEX 1.2
// Section 3.3.2 "Disconnect" and Section 3.3.5 "Abort", IrOBEX 1.2
// The format of response packet of "Disconnect" and "Abort" are the same
// [opcode:1][length:2][Headers:var]
uint8_t req[255];
int index = 3;

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

@ -101,7 +101,7 @@ private:
bool WriteToFile(const uint8_t* aData, int aDataLength);
void DeleteReceivedFile();
void ReplyToConnect();
void ReplyToDisconnect();
void ReplyToDisconnectOrAbort();
void ReplyToPut(bool aFinal, bool aContinue);
void AfterOppConnected();
void AfterFirstPut();