Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0539a96 authored by Nalla Kartheek's avatar Nalla Kartheek
Browse files

framework/base: Do not kill the supplicant on a request to stop it

Supplicant is killed on obtaining the first TERMINATE event when
requested to stop from the framework. This shall result in improper
shutdown of the supplicant without proper cleanup of the resources
allocated for all the interfaces.
Moreover, there is no point in killing the supplicant when the
request itself is to to stop the same. Thus, do not kill the
supplicant on the TERMINATE event.

Change-Id: I954bb09faa94252eea53a14b090a6cff610c5964
CRs-Fixed: 601759
parent ccde8a2d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -2301,11 +2301,13 @@ public class WifiStateMachine extends StateMachine {
        mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
    }

    private void handleSupplicantConnectionLoss() {
    private void handleSupplicantConnectionLoss(boolean killSupplicant) {
        /* Socket connection can be lost when we do a graceful shutdown
        * or when the driver is hung. Ensure supplicant is stopped here.
        */
        if (killSupplicant){
            mWifiMonitor.killSupplicant(mP2pSupported);
        }
        mWifiNative.closeSupplicantConnection();
        sendSupplicantConnectionChangedBroadcast(false);
        setWifiState(WIFI_STATE_DISABLED);
@@ -2852,7 +2854,7 @@ public class WifiStateMachine extends StateMachine {
                    break;
                case WifiMonitor.SUP_DISCONNECTION_EVENT:  /* Supplicant connection lost */
                    loge("Connection lost, restart supplicant");
                    handleSupplicantConnectionLoss();
                    handleSupplicantConnectionLoss(true);
                    handleNetworkDisconnect();
                    mSupplicantStateTracker.sendMessage(CMD_RESET_SUPPLICANT_STATE);
                    if (mP2pSupported) {
@@ -2917,13 +2919,13 @@ public class WifiStateMachine extends StateMachine {
                    break;
                case WifiMonitor.SUP_DISCONNECTION_EVENT:
                    if (DBG) log("Supplicant connection lost");
                    handleSupplicantConnectionLoss();
                    handleSupplicantConnectionLoss(false);
                    transitionTo(mInitialState);
                    break;
                case CMD_STOP_SUPPLICANT_FAILED:
                    if (message.arg1 == mSupplicantStopFailureToken) {
                        loge("Timed out on a supplicant stop, kill and proceed");
                        handleSupplicantConnectionLoss();
                        handleSupplicantConnectionLoss(true);
                        transitionTo(mInitialState);
                    }
                    break;