core: in periodic_update_active_connection_timestamps() use same timestamp
When performing a synchronous action together (like iterating over all settings and set the current timestamp), it's nicer to pretend that all this would happen instantaneously. That means, ensure we use the same timestamp throughout. On a minor point, there really is no need to call time() multiple times.
This commit is contained in:
@@ -7344,12 +7344,19 @@ periodic_update_active_connection_timestamps (gpointer user_data)
|
|||||||
NMManager *manager = NM_MANAGER (user_data);
|
NMManager *manager = NM_MANAGER (user_data);
|
||||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
||||||
NMActiveConnection *ac;
|
NMActiveConnection *ac;
|
||||||
|
gboolean has_time = FALSE;
|
||||||
|
guint64 t;
|
||||||
|
|
||||||
c_list_for_each_entry (ac, &priv->active_connections_lst_head, active_connections_lst) {
|
c_list_for_each_entry (ac, &priv->active_connections_lst_head, active_connections_lst) {
|
||||||
if (nm_active_connection_get_state (ac) == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
|
if (nm_active_connection_get_state (ac) != NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
|
||||||
nm_settings_connection_update_timestamp (nm_active_connection_get_settings_connection (ac),
|
continue;
|
||||||
(guint64) time (NULL));
|
|
||||||
|
if (!has_time) {
|
||||||
|
t = time (NULL);
|
||||||
|
has_time = TRUE;
|
||||||
}
|
}
|
||||||
|
nm_settings_connection_update_timestamp (nm_active_connection_get_settings_connection (ac),
|
||||||
|
t);
|
||||||
}
|
}
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user