mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-29 14:40:24 +01:00
checkpoint: minor cleanup rolling back checkpoints
This commit is contained in:
parent
79458a558b
commit
e6e0eb92b9
1 changed files with 14 additions and 7 deletions
|
|
@ -82,11 +82,20 @@ destroy_checkpoint (NMCheckpointManager *self, NMCheckpoint *checkpoint)
|
|||
g_object_unref (checkpoint);
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
rollback_checkpoint (NMCheckpointManager *self, NMCheckpoint *checkpoint)
|
||||
{
|
||||
GVariant *result;
|
||||
|
||||
result = nm_checkpoint_rollback (checkpoint);
|
||||
destroy_checkpoint (self, checkpoint);
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
rollback_timeout_cb (NMCheckpointManager *self)
|
||||
{
|
||||
NMCheckpoint *checkpoint, *checkpoint_safe;
|
||||
GVariant *result;
|
||||
gint64 ts, now;
|
||||
|
||||
self->rollback_timeout_id = 0;
|
||||
|
|
@ -96,10 +105,9 @@ rollback_timeout_cb (NMCheckpointManager *self)
|
|||
c_list_for_each_entry_safe (checkpoint, checkpoint_safe, &self->checkpoints_lst_head, checkpoints_lst) {
|
||||
ts = nm_checkpoint_get_rollback_ts (checkpoint);
|
||||
if (ts && ts <= now) {
|
||||
result = nm_checkpoint_rollback (checkpoint);
|
||||
if (result)
|
||||
g_variant_unref (result);
|
||||
destroy_checkpoint (self, checkpoint);
|
||||
gs_unref_variant GVariant *result = NULL;
|
||||
|
||||
result = rollback_checkpoint (self, checkpoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,8 +290,7 @@ nm_checkpoint_manager_rollback (NMCheckpointManager *self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
*results = nm_checkpoint_rollback (checkpoint);
|
||||
destroy_checkpoint (self, checkpoint);
|
||||
*results = rollback_checkpoint (self, checkpoint);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue