From 3af9209d47bbae7954da9dd5dabe6154fdb9b3c2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 30 Apr 2020 09:59:04 +0200 Subject: [PATCH] wifi: don't unnecessarily trim tracked ssid list Only _scan_request_ssids_track() adds elements to the list, and that already trims the list to a maxium length. In all other cases, we never expect a need to trim the list. --- src/devices/wifi/nm-device-wifi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index af12f6b223..5a4672d05a 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -262,10 +262,10 @@ _scan_request_ssids_remove_all (NMDeviceWifiPrivate *priv, d = c_list_last_entry (&priv->scan_request_ssids_lst_head, ScanRequestSsidData, lst); _scan_request_ssids_remove (priv, d, NULL); } - nm_assert (i == nm_g_hash_table_size (priv->scan_request_ssids_hash)); - nm_assert (i == c_list_length (&priv->scan_request_ssids_lst_head)); - nm_assert (i <= cutoff_at_len); } + + nm_assert (nm_g_hash_table_size (priv->scan_request_ssids_hash) <= SCAN_REQUEST_SSIDS_MAX_NUM); + nm_assert (nm_g_hash_table_size (priv->scan_request_ssids_hash) == c_list_length (&priv->scan_request_ssids_lst_head)); } static GPtrArray * @@ -275,11 +275,9 @@ _scan_request_ssids_fetch (NMDeviceWifiPrivate *priv, gint64 now_msec) GPtrArray *ssids; guint len; - _scan_request_ssids_remove_all (priv, now_msec, SCAN_REQUEST_SSIDS_MAX_NUM); + _scan_request_ssids_remove_all (priv, now_msec, G_MAXUINT); len = nm_g_hash_table_size (priv->scan_request_ssids_hash); - nm_assert (len == c_list_length (&priv->scan_request_ssids_lst_head)); - if (len == 0) return NULL; @@ -1702,7 +1700,7 @@ _scan_kickoff (NMDeviceWifi *self) now_msec = nm_utils_get_monotonic_timestamp_msec (); - _scan_request_ssids_remove_all (priv, now_msec, SCAN_REQUEST_SSIDS_MAX_NUM); + _scan_request_ssids_remove_all (priv, now_msec, G_MAXUINT); device_state = nm_device_get_state (NM_DEVICE (self)); if ( device_state > NM_DEVICE_STATE_DISCONNECTED