wifi: pass now_msec to _scan_request_ssids_fetch()

We make decisions based on the timestamp. We should only fetch the timestamp
once, and make consistent decisions about that. Don't read different timestamps.
This commit is contained in:
Thomas Haller 2020-04-30 09:54:23 +02:00
parent 8fb2241183
commit a0e115cb44

View file

@ -269,13 +269,13 @@ _scan_request_ssids_remove_all (NMDeviceWifiPrivate *priv,
} }
static GPtrArray * static GPtrArray *
_scan_request_ssids_fetch (NMDeviceWifiPrivate *priv) _scan_request_ssids_fetch (NMDeviceWifiPrivate *priv, gint64 now_msec)
{ {
ScanRequestSsidData *srs_data; ScanRequestSsidData *srs_data;
GPtrArray *ssids; GPtrArray *ssids;
guint len; guint len;
_scan_request_ssids_remove_all (priv, nm_utils_get_monotonic_timestamp_msec (), SCAN_REQUEST_SSIDS_MAX_NUM); _scan_request_ssids_remove_all (priv, now_msec, SCAN_REQUEST_SSIDS_MAX_NUM);
len = nm_g_hash_table_size (priv->scan_request_ssids_hash); len = nm_g_hash_table_size (priv->scan_request_ssids_hash);
nm_assert (len == c_list_length (&priv->scan_request_ssids_lst_head)); nm_assert (len == c_list_length (&priv->scan_request_ssids_lst_head));
@ -1531,6 +1531,7 @@ hidden_filter_func (NMSettings *settings,
static GPtrArray * static GPtrArray *
_scan_request_ssids_build_hidden (NMDeviceWifi *self, _scan_request_ssids_build_hidden (NMDeviceWifi *self,
gint64 now_msec,
gboolean *out_has_hidden_profiles) gboolean *out_has_hidden_profiles)
{ {
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
@ -1545,7 +1546,7 @@ _scan_request_ssids_build_hidden (NMDeviceWifi *self,
NM_SET_OUT (out_has_hidden_profiles, FALSE); NM_SET_OUT (out_has_hidden_profiles, FALSE);
/* collect all pending explicit SSIDs. */ /* collect all pending explicit SSIDs. */
ssids = _scan_request_ssids_fetch (priv); ssids = _scan_request_ssids_fetch (priv, now_msec);
if (max_scan_ssids == 0) { if (max_scan_ssids == 0) {
/* no space. @ssids will be ignored. */ /* no space. @ssids will be ignored. */
@ -1764,7 +1765,7 @@ _scan_kickoff (NMDeviceWifi *self)
priv->scan_periodic_next_msec = now_msec + 1000 * priv->scan_periodic_interval_sec; priv->scan_periodic_next_msec = now_msec + 1000 * priv->scan_periodic_interval_sec;
} }
ssids = _scan_request_ssids_build_hidden (self, &has_hidden_profiles); ssids = _scan_request_ssids_build_hidden (self, now_msec, &has_hidden_profiles);
if (has_hidden_profiles) { if (has_hidden_profiles) {
if (priv->hidden_probe_scan_warn) { if (priv->hidden_probe_scan_warn) {
priv->hidden_probe_scan_warn = FALSE; priv->hidden_probe_scan_warn = FALSE;