diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-04-10 13:25:41 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-04-11 08:58:28 +0200 |
commit | 583eba38280628da9c645d402483f9fd0927005a (patch) | |
tree | d8ab32ad881bdf16e4f9a59cdae3c4cb6c5abf2b | |
parent | 2200687b0f92d553dc79e54b672069b2b704203d (diff) |
core: sort connections in descending timestamp order on take-over (rh #1067712)
When assuming the connections on restart we want to prefer more-recently-used
connections. That's why we have to sort connections according to timestamps in
descending order. That means connections used more recently (higher timestamp)
go before connections with lower timestamp.
https://bugzilla.redhat.com/show_bug.cgi?id=1067712
-rw-r--r-- | src/nm-manager.c | 2 | ||||
-rw-r--r-- | src/settings/nm-settings.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index d3d660cd70..f991b040ee 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1706,7 +1706,7 @@ get_existing_connection (NMManager *manager, NMDevice *device) * When no configured connection matches the generated connection, we keep * the generated connection instead. */ - connections = g_slist_sort (connections, nm_settings_sort_connections); + connections = g_slist_reverse (g_slist_sort (connections, nm_settings_sort_connections)); matched = nm_utils_match_connection (connections, connection, nm_device_has_carrier (device), diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 852fa6d145..b4d9c22ea3 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -1685,7 +1685,11 @@ nm_settings_device_removed (NMSettings *self, NMDevice *device, gboolean quittin /***************************************************************/ -/* GCompareFunc helper for sorting "best" connections */ +/* GCompareFunc helper for sorting "best" connections. + * The function sorts connections in ascending timestamp order. + * That means an older connection (lower timestamp) goes before + * a newer one. + */ gint nm_settings_sort_connections (gconstpointer a, gconstpointer b) { |