add extra case to waitForConnection
This commit is contained in:
@@ -524,22 +524,23 @@ func waitForConnection(dev gonm.DeviceWireless, ssid string, timeout time.Durati
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// NmDeviceStateActivated = 100, fully connected with IP
|
logger.Debug("network: device state %d, waiting...", state)
|
||||||
if state == gonm.NmDeviceStateActivated {
|
|
||||||
// Confirm it's actually the SSID we wanted
|
switch state {
|
||||||
|
case gonm.NmDeviceStateActivated:
|
||||||
current, err := CurrentNetwork()
|
current, err := CurrentNetwork()
|
||||||
if err == nil && current == ssid {
|
if err == nil && current == ssid {
|
||||||
logger.Info("network: fully connected to %q", ssid)
|
logger.Info("network: fully connected to %q (DHCP complete)", ssid)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NmDeviceStateFailed = 120, NmDeviceStateDisconnected = 30
|
case gonm.NmDeviceStateFailed:
|
||||||
if state == gonm.NmDeviceStateFailed {
|
|
||||||
return fmt.Errorf("network: connection to %q failed (wrong password?)", ssid)
|
return fmt.Errorf("network: connection to %q failed (wrong password?)", ssid)
|
||||||
|
|
||||||
|
case gonm.NmDeviceStateDisconnected:
|
||||||
|
return fmt.Errorf("network: connection to %q was rejected by the network", ssid)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Debug("network: device state %d, waiting...", state)
|
|
||||||
time.Sleep(500 * time.Millisecond)
|
time.Sleep(500 * time.Millisecond)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("network: timed out waiting for connection to %q", ssid)
|
return fmt.Errorf("network: timed out waiting for connection to %q", ssid)
|
||||||
|
|||||||
Reference in New Issue
Block a user