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

Commit 29dc67a4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 3adcf9ab cd13e350
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -497,6 +497,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");
@@ -540,8 +541,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;
                    }
                }
@@ -669,8 +681,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);