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

Commit cd13e350 authored by Naresh Jayaram's avatar Naresh Jayaram
Browse files

P2P : Wait for the terminate events on all the open interfaces

On a stop supplicant request from the framework , supplicant
shall issue TERMINATE event for per interface created and
thus WiFiMonotor shall kill the supplicant on the TERMINATE
event obtained on wlan0 interface.This would end up in not
deleting the other interfaces and thus they would be seen
as an active interfaces. Thus wait for the number of
TERMINATE events obtained corresponding to the number
of WiFiMonitor instances registered before killing
the supplicant.

Change-Id: I2d36d85d00073cf9a200dc92f94beefa4efe6087
CRs-Fixed: 601759
parent e9bf2de0
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -490,6 +490,7 @@ public class WifiMonitor {
        private final WifiMonitorSingleton mWifiMonitorSingleton;
        private int mRecvErrors = 0;
        private StateMachine mStateMachine = null;
        private int mTerminateEventCount = 0;

        public MonitorThread(WifiNative wifiNative, WifiMonitorSingleton wifiMonitorSingleton) {
            super("WifiMonitor");
@@ -533,8 +534,19 @@ public class WifiMonitor {
                    if (m.mMonitoring) {
                        mStateMachine = m.mWifiStateMachine;
                    } else {
                        String eventStrNoWS = eventStr.replaceAll("\\s+", "");
                        if (DBG) Log.d(TAG, "Dropping event because monitor (" + iface +
                                            ") is stopped");
                            if (eventStrNoWS.endsWith("CTRL-EVENT-TERMINATING")) {
                                mTerminateEventCount ++;
                                if (mTerminateEventCount >= mWifiMonitorSingleton.mIfaceMap.size()){
                                    Log.e(TAG, "Report SUP_DISCONNECT_EVENT");
                                    WifiStateMachine wifiStateMachine = (WifiStateMachine)
                                     mWifiMonitorSingleton.getMonitor("wlan0").mWifiStateMachine;
                                    wifiStateMachine.sendMessage(SUP_DISCONNECTION_EVENT);
                                    break;
                                }
                        }
                        continue;
                    }
                }
@@ -662,8 +674,14 @@ public class WifiMonitor {
                }

                // notify and exit
                mStateMachine.sendMessage(SUP_DISCONNECTION_EVENT);
                mTerminateEventCount ++;
                if (mTerminateEventCount >= mWifiMonitorSingleton.mIfaceMap.size()) {
                    Log.e(TAG, "Report SUP_DISCONNECT_EVENT");
                    WifiStateMachine wifiStateMachine = (WifiStateMachine)
                     mWifiMonitorSingleton.getMonitor("wlan0").mWifiStateMachine;
                    wifiStateMachine.sendMessage(SUP_DISCONNECTION_EVENT);
                    return true;
                }
            } else if (event == EAP_FAILURE) {
                if (eventData.startsWith(EAP_AUTH_FAILURE_STR)) {
                    mStateMachine.sendMessage(AUTHENTICATION_FAILURE_EVENT);