mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 03:30:09 +01:00
wifi: improve scan result request throttling
Throttle requesting scan results to be at least four seconds, instead of always forcing a 4 second delay after the first scan.
This commit is contained in:
parent
be9bc944d4
commit
618697aaab
1 changed files with 11 additions and 3 deletions
|
|
@ -597,15 +597,23 @@ static void
|
|||
wpas_iface_query_scan_results (DBusGProxy *proxy, gpointer user_data)
|
||||
{
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (user_data);
|
||||
GTimeVal cur_time;
|
||||
|
||||
/* Only query scan results if a query is not queued */
|
||||
if (priv->scan_results_timeout)
|
||||
return;
|
||||
|
||||
g_get_current_time (&cur_time);
|
||||
|
||||
/* Only fetch scan results every 4s max, but initially do it right away */
|
||||
priv->scan_results_timeout = g_timeout_add_seconds (priv->last_scan ? 4 : 0,
|
||||
request_scan_results,
|
||||
user_data);
|
||||
if (priv->last_scan + 4 < cur_time.tv_sec) {
|
||||
priv->scan_results_timeout = g_idle_add (request_scan_results,
|
||||
user_data);
|
||||
} else {
|
||||
priv->scan_results_timeout =
|
||||
g_timeout_add_seconds ((4 - (cur_time.tv_sec - priv->last_scan)),
|
||||
request_scan_results, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static guint32
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue