station: Move device_disassociate to station

This commit is contained in:
Denis Kenzior 2018-09-04 21:28:18 -05:00
parent 520d3ad6b2
commit d8617a5000
4 changed files with 40 additions and 44 deletions

View File

@ -81,20 +81,6 @@ static bool device_is_busy(struct device *device)
return station_is_busy(device->station);
}
void device_disassociated(struct device *device)
{
struct station *station = device->station;
l_debug("%d", device->index);
station_reset_connection_state(station);
station_enter_state(station, STATION_STATE_DISCONNECTED);
if (station->autoconnect)
station_enter_state(station, STATION_STATE_AUTOCONNECT);
}
static void device_disconnect_event(struct device *device)
{
struct station *station = device->station;
@ -110,7 +96,7 @@ static void device_disconnect_event(struct device *device)
network_connect_failed(network);
}
device_disassociated(device);
station_disassociated(station);
}
static void device_reassociate_cb(struct netdev *netdev,
@ -372,7 +358,7 @@ static void device_connect_cb(struct netdev *netdev, enum netdev_result result,
if (result != NETDEV_RESULT_OK) {
if (result != NETDEV_RESULT_ABORTED) {
network_connect_failed(station->connected_network);
device_disassociated(device);
station_disassociated(station);
}
return;

View File

@ -28,7 +28,6 @@ struct netdev;
struct network;
struct device;
void device_disassociated(struct device *device);
void device_transition_start(struct device *device, struct scan_bss *bss);
int __device_connect_network(struct device *device, struct network *network,

View File

@ -681,6 +681,42 @@ static void station_roam_state_clear(struct station *station)
station->roam_scan_id);
}
static void station_reset_connection_state(struct station *station)
{
struct network *network = station->connected_network;
struct l_dbus *dbus = dbus_get_bus();
if (!network)
return;
if (station->state == STATION_STATE_CONNECTED ||
station->state == STATION_STATE_CONNECTING ||
station->state == STATION_STATE_ROAMING)
network_disconnected(network);
station_roam_state_clear(station);
station->connected_bss = NULL;
station->connected_network = NULL;
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_DEVICE_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),
IWD_NETWORK_INTERFACE, "Connected");
}
void station_disassociated(struct station *station)
{
l_debug("%u", netdev_get_ifindex(station->netdev));
station_reset_connection_state(station);
station_enter_state(station, STATION_STATE_DISCONNECTED);
if (station->autoconnect)
station_enter_state(station, STATION_STATE_AUTOCONNECT);
}
static void station_roam_timeout_rearm(struct station *station, int seconds);
void station_roamed(struct station *station)
@ -696,7 +732,6 @@ void station_roamed(struct station *station)
void station_roam_failed(struct station *station)
{
struct device *device = netdev_get_device(station->netdev);
/*
* If we're still connected to the old BSS, only clear preparing_roam
* and reattempt in 60 seconds if signal level is still low at that
@ -712,7 +747,7 @@ void station_roam_failed(struct station *station)
station->ap_directed_roaming = false;
if (station->state == STATION_STATE_ROAMING)
device_disassociated(device);
station_disassociated(station);
else if (station->signal_low)
station_roam_timeout_rearm(station, 60);
}
@ -1232,30 +1267,6 @@ void station_ok_rssi(struct station *station)
station->signal_low = false;
}
void station_reset_connection_state(struct station *station)
{
struct network *network = station->connected_network;
struct l_dbus *dbus = dbus_get_bus();
if (!network)
return;
if (station->state == STATION_STATE_CONNECTED ||
station->state == STATION_STATE_CONNECTING ||
station->state == STATION_STATE_ROAMING)
network_disconnected(network);
station_roam_state_clear(station);
station->connected_bss = NULL;
station->connected_network = NULL;
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_DEVICE_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),
IWD_NETWORK_INTERFACE, "Connected");
}
static void station_hidden_network_scan_triggered(int err, void *user_data)
{
struct station *station = user_data;

View File

@ -108,7 +108,7 @@ void station_ap_directed_roam(struct station *station,
void station_low_rssi(struct station *station);
void station_ok_rssi(struct station *station);
void station_reset_connection_state(struct station *station);
void station_disassociated(struct station *station);
struct l_dbus_message *station_dbus_connect_hidden_network(
struct l_dbus *dbus,