mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-10 23:00:30 +01:00
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
This commit is contained in:
parent
2200687b0f
commit
583eba3828
2 changed files with 6 additions and 2 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue