Bug 805724 - Patch 3: Let user be able to terminate receiving process by calling StopSendingFile(). r=qdot, a=blocking-basecamp
authorEric Chou <echou@mozilla.com>
Sat, 03 Nov 2012 09:36:39 +0800
changeset 116641 3c39eafb24a1c6f2c641806e95312055f63efd5c
parent 116640 471d6d92eceba42dd7990ca0e8028b86545c3cc5
child 116642 acda15a7388b5e54c12b297b66ebc61a8736a865
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot, blocking-basecamp
bugs805724
milestone18.0a2
Bug 805724 - Patch 3: Let user be able to terminate receiving process by calling StopSendingFile(). r=qdot, a=blocking-basecamp
dom/bluetooth/BluetoothOppManager.cpp
--- a/dom/bluetooth/BluetoothOppManager.cpp
+++ b/dom/bluetooth/BluetoothOppManager.cpp
@@ -199,20 +199,16 @@ BluetoothOppManager::SendFile(BlobParent
   SendConnectRequest();
 
   return true;
 }
 
 bool
 BluetoothOppManager::StopSendingFile(BluetoothReplyRunnable* aRunnable)
 {
-  if (!mBlob) {
-    return false;
-  }
-
   mAbortFlag = true;
 
   return true;
 }
 
 void
 BluetoothOppManager::ConfirmReceivingFile(bool aConfirm,
                                           BluetoothReplyRunnable* aRunnable)
@@ -527,22 +523,26 @@ BluetoothOppManager::ReceiveSocketData(U
         mUpdateProgressCounter = sSentFileLength / kUpdateProgressBase + 1;
       }
 
       if (mPacketLeftLength == 0) {
         if (mWaitingForConfirmationFlag) {
           ReceivingFileConfirmation(mConnectedDeviceAddress, sFileName,
                                     sFileLength, sContentType);
         } else {
-          ReplyToPut(mPutFinal, true);
+          ReplyToPut(mPutFinal, mAbortFlag ? false : true);
 
-          if (mPutFinal) {
+          if (mAbortFlag) {
             mReceiving = false;
-            FileTransferComplete(mConnectedDeviceAddress, true, true, sFileName,
-                                 sSentFileLength, sContentType);
+            FileTransferComplete(mConnectedDeviceAddress, false, true,
+                                 sFileName, sSentFileLength, sContentType);
+          } else if (mPutFinal) {
+            mReceiving = false;
+            FileTransferComplete(mConnectedDeviceAddress, true, true,
+                                 sFileName, sSentFileLength, sContentType);
           }
         }
       }
     }
   }
 }
 
 void