Bug 1123680 - Forget Wifi cause problems to reconnect on it immediately. r=hchang

This commit is contained in:
Amy Chung 2015-03-26 00:52:00 -04:00
parent 7ae5499be8
commit 392ca34c49

View File

@ -3266,7 +3266,23 @@ WifiWorker.prototype = {
WifiManager.reconnect(function (ok) {
self._sendMessage(message, ok, ok, msg);
});
} else {
} else if (WifiManager.state == "INACTIVE") {
// If AP info didn't clear, then call associate function.
// That maybe occurs wpa supplicant that suppose already associated.
// To avoid this case, need to clear AP info and call reassoiate
// in INACTIVE state.
let networkKey = getNetworkKey(network);
if (!(networkKey in this.configuredNetworks)) {
self._sendMessage(message, false, "Trying to forget an unknown network", msg);
return;
}
let configured = this.configuredNetworks[networkKey];
WifiManager.removeNetwork(configured.netId, function() {
WifiManager.reassociate(function() {
self._sendMessage(message, ok, ok, msg);
});
});
}else {
self._sendMessage(message, ok, ok, msg);
}
});