mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 914514 - Close socket right after the user stops the transmission, r=gyeh, r=btian
Instead of setting a flag, this patch would shutdown current connection right after the user stopped the transmission.
This commit is contained in:
parent
c897785f6d
commit
1e7ea56b53
@ -389,7 +389,13 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
bool
|
||||
BluetoothOppManager::StopSendingFile()
|
||||
{
|
||||
mAbortFlag = true;
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mIsServer) {
|
||||
mAbortFlag = true;
|
||||
} else {
|
||||
Disconnect(nullptr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -929,11 +935,6 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAbortFlag) {
|
||||
SendAbortRequest();
|
||||
return;
|
||||
}
|
||||
|
||||
if (kUpdateProgressBase * mUpdateProgressCounter < mSentFileLength) {
|
||||
UpdateProgress();
|
||||
mUpdateProgressCounter = mSentFileLength / kUpdateProgressBase + 1;
|
||||
@ -1083,19 +1084,6 @@ BluetoothOppManager::SendDisconnectRequest()
|
||||
SendObexData(req, ObexRequestCode::Disconnect, index);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::SendAbortRequest()
|
||||
{
|
||||
if (!mConnected) return;
|
||||
|
||||
// Section 3.3.5 "Abort", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
uint8_t req[255];
|
||||
int index = 3;
|
||||
|
||||
SendObexData(req, ObexRequestCode::Abort, index);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::CheckPutFinal(uint32_t aNumRead)
|
||||
{
|
||||
|
@ -56,7 +56,6 @@ public:
|
||||
void SendPutRequest(uint8_t* aFileBody, int aFileBodyLength);
|
||||
void SendPutFinalRequest();
|
||||
void SendDisconnectRequest();
|
||||
void SendAbortRequest();
|
||||
|
||||
void ExtractPacketHeaders(const ObexHeaderSet& aHeader);
|
||||
bool ExtractBlobHeaders();
|
||||
|
Loading…
Reference in New Issue
Block a user