commit 94d4b341e3990324fd18a6e9cf5de7986a3d1770
parent 4fbfa76fc58fbdfae84a964511c6b8c7f474371f
Author: Alvin Šipraga <alsi@bang-olufsen.dk>
Date: Fri, 14 Aug 2020 15:40:32 +0200
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.
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/station.c b/src/station.c
@@ -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),