Commit 862ce989 authored by gspencer@chromium.org's avatar gspencer@chromium.org

This fixes connecting to hidden networks by not marking them failed

when they fail to show up in the wifi scan (they're hidden, so they
aren't expected to show up).

BUG=chromium:137273
TEST=Ran on device, tested connection to hidden network multiple times
     with no failure.


Review URL: https://chromiumcodereview.appspot.com/10849003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149283 0039d316-1c4b-4281-b951-d872f2087c98
parent 2b4081c8
......@@ -289,13 +289,16 @@ void Network::SetState(ConnectionState new_state) {
// CONNECT_REQUESTED is set internally. Shill/flimflam do not update the
// state immediately, so ignore any Idle state updates sent while a
// connection attempt is in progress.
VLOG(2) << "Ignoring idle state change after connection request.";
return;
}
ConnectionState old_state = state_;
VLOG(2) << "Entering new state: " << ConnectionStateString(new_state);
state_ = new_state;
if (!IsConnectingState(new_state))
set_connection_started(false);
if (new_state == STATE_FAILURE) {
VLOG(2) << "Detected Failure state.";
if (old_state != STATE_UNKNOWN && old_state != STATE_IDLE) {
// New failure, the user needs to be notified.
// Transition STATE_IDLE -> STATE_FAILURE sometimes happens on resume
......@@ -303,9 +306,11 @@ void Network::SetState(ConnectionState new_state) {
notify_failure_ = true;
// Normally error_ should be set, but if it is not we need to set it to
// something here so that the retry logic will be triggered.
if (error_ == ERROR_NO_ERROR)
if (error_ == ERROR_NO_ERROR) {
VLOG(2) << "Detected NO_ERROR error state. Setting to UNKNOWN.";
error_ = ERROR_UNKNOWN;
}
}
} else if (new_state != STATE_UNKNOWN) {
notify_failure_ = false;
// State changed, so refresh IP address.
......
......@@ -898,7 +898,8 @@ void NetworkLibraryImplBase::NetworkConnectCompleted(
}
VLOG(1) << "Connected to network: " << network->name()
<< " State: " << network->state();
<< " State: " << network->state()
<< " Status: " << status;
// If the user asked not to save credentials, flimflam will have
// forgotten them. Wipe our cache as well.
......
......@@ -839,11 +839,16 @@ void NetworkLibraryImplCros::UpdateNetworkServiceList(
<< " State = " << network->GetStateString()
<< " connecting = " << network->connecting()
<< " connection_started = " << network->connection_started();
WifiNetwork* wifi = NULL;
if (network->type() == TYPE_WIFI)
wifi = static_cast<WifiNetwork*>(network);
if (network->failed() && network->notify_failure()) {
// We have not notified observers of a connection failure yet.
AddNetwork(network);
} else if (network->connecting() && network->connection_started()) {
// Network was in connecting state; set state to failed.
} else if (network->connecting() && network->connection_started() &&
!(wifi && wifi->hidden_ssid())) {
// Network was in connecting state; set state to failed, but not if it
// had a hidden SSID (since that won't appear in the scanning list).
VLOG(2) << "Removed network was connecting: " << network->name();
network->SetState(STATE_FAILURE);
AddNetwork(network);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment