vici: Replace child configs atomically
This also leaves unmodified configs as they are.
This commit is contained in:
@@ -1847,22 +1847,19 @@ static void replace_children(private_vici_config_t *this,
|
|||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
child_cfg_t *child;
|
child_cfg_t *child;
|
||||||
|
bool added;
|
||||||
|
|
||||||
enumerator = to->create_child_cfg_enumerator(to);
|
enumerator = to->replace_child_cfgs(to, from);
|
||||||
while (enumerator->enumerate(enumerator, &child))
|
while (enumerator->enumerate(enumerator, &child, &added))
|
||||||
{
|
{
|
||||||
to->remove_child_cfg(to, enumerator);
|
if (added)
|
||||||
clear_start_action(this, to->get_name(to), child);
|
{
|
||||||
child->destroy(child);
|
run_start_action(this, to, child);
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
else
|
||||||
|
{
|
||||||
enumerator = from->create_child_cfg_enumerator(from);
|
clear_start_action(this, to->get_name(to), child);
|
||||||
while (enumerator->enumerate(enumerator, &child))
|
}
|
||||||
{
|
|
||||||
from->remove_child_cfg(from, enumerator);
|
|
||||||
to->add_child_cfg(to, child);
|
|
||||||
run_start_action(this, to, child);
|
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user