3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

station: refresh ordered network list on (dis)connect

Doing so ensures that the currently connected network is always at the
beginning of the list. Previously, the list would only get updated after
a scan.

This fixes the documented behaviour of GetOrderedNetworks() DBus method,
which states that the currently connected network is always at the
beginning of the returned array.
This commit is contained in:
Alvin Šipraga 2020-08-14 15:40:32 +02:00 committed by Denis Kenzior
parent 4fbfa76fc5
commit 94d4b341e3

View File

@ -1195,6 +1195,12 @@ static void station_enter_state(struct station *station,
new_scan_results, station);
break;
case STATION_STATE_CONNECTING:
/* Refresh the ordered network list */
network_rank_update(station->connected_network, true);
l_queue_remove(station->networks_sorted, station->connected_network);
l_queue_insert(station->networks_sorted, station->connected_network,
network_rank_compare, NULL);
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus,
@ -1295,6 +1301,12 @@ static void station_reset_connection_state(struct station *station)
station->connected_bss = NULL;
station->connected_network = NULL;
/* Refresh the ordered network list */
network_rank_update(station->connected_network, false);
l_queue_remove(station->networks_sorted, station->connected_network);
l_queue_insert(station->networks_sorted, station->connected_network,
network_rank_compare, NULL);
l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
IWD_STATION_INTERFACE, "ConnectedNetwork");
l_dbus_property_changed(dbus, network_get_path(network),