Bug 1087153 - Only attempt to close p2p supplicant connection before KK. r=vchang.
authorHenry Chang <hchang@mozilla.com>
Mon, 27 Oct 2014 10:09:51 +0800
changeset 212740 3ea653e3c95f7a12d685ef2b4c60afc58b8d0f5d
parent 212739 fb989564c63465053290a76522ba2cb7da318bc8
child 212741 51a6ac1102e3beb3696810115690f13f0f8f3582
push id51042
push userryanvm@gmail.com
push dateTue, 28 Oct 2014 20:25:03 +0000
treeherdermozilla-inbound@53d84829b2b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvchang
bugs1087153
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1087153 - Only attempt to close p2p supplicant connection before KK. r=vchang. Since we would only use single connection to communicate with wpa_supplicant on different interface (wlan0/p2p0) since KK, there's no need to close supplicant connection in the p2p state machine.
dom/wifi/WifiP2pManager.jsm
--- a/dom/wifi/WifiP2pManager.jsm
+++ b/dom/wifi/WifiP2pManager.jsm
@@ -1325,26 +1325,35 @@ function P2pStateMachine(aP2pCommand, aN
 
   var stateDisabling = _sm.makeState("DISABLING", {
     enter: function() {
       _sm.pause();
       aNetUtil.stopDhcpServer(function (success) { // Stopping DHCP server is harmless.
         debug('Stop DHCP server result: ' + success);
         aP2pCommand.p2pDisable(function(success) {
           debug('P2P function disabled');
-          aP2pCommand.closeSupplicantConnection(function (status) {
+          closeSupplicantConnectionIfNeeded(function() {
             debug('Supplicant connection closed');
             gNetworkService.disableInterface(P2P_INTERFACE_NAME, function (success){
               debug('Disabled interface: ' + P2P_INTERFACE_NAME);
               _onDisabled(true);
               _sm.gotoState(stateDisabled);
             });
           });
         });
       });
+
+      function closeSupplicantConnectionIfNeeded(callback) {
+        // No need to connect to supplicant on KK. Call back directly.
+        if (aP2pCommand.getSdkVersion() >= 19) {
+          callback();
+          return;
+        }
+        aP2pCommand.closeSupplicantConnection(callback);
+      }
     },
 
     handleEvent: function(aEvent) {
       return false; // We will not receive any event in this state.
     }
   });
 
   //----------------------------------------------------------