Merge pull request 'Fix network connection timeouts and security detection' (#59) from wifi-fix-06-28-2026 into dev
Reviewed-on: https://codeberg.org/RhemaWave-Technologies/RhemaWave/pulls/59
This commit is contained in:
@@ -541,22 +541,23 @@ func waitForConnection(dev gonm.DeviceWireless, ssid string, timeout time.Durati
|
||||
continue
|
||||
}
|
||||
|
||||
// NmDeviceStateActivated = 100, fully connected with IP
|
||||
if state == gonm.NmDeviceStateActivated {
|
||||
// Confirm it's actually the SSID we wanted
|
||||
logger.Debug("network: device state %d, waiting...", state)
|
||||
|
||||
switch state {
|
||||
case gonm.NmDeviceStateActivated:
|
||||
current, err := CurrentNetwork()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// NmDeviceStateFailed = 120, NmDeviceStateDisconnected = 30
|
||||
if state == gonm.NmDeviceStateFailed {
|
||||
case gonm.NmDeviceStateFailed:
|
||||
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)
|
||||
}
|
||||
return fmt.Errorf("network: timed out waiting for connection to %q", ssid)
|
||||
|
||||
Reference in New Issue
Block a user