policy-node: avoid rescan when moving a node

When we are moving a node, the node becomes unlinked temporarily.
Make sure the rescan code doesn't try to link it to a node
meanwhile.

Fixes #344
This commit is contained in:
Wim Taymans 2020-10-21 15:27:50 +02:00
parent 71c760de14
commit bfac6f04db

View file

@ -97,6 +97,7 @@ struct node {
unsigned int configured:1;
unsigned int dont_remix:1;
unsigned int monitor:1;
unsigned int moving:1;
};
static bool find_format(struct node *node)
@ -557,6 +558,10 @@ static int rescan_node(struct impl *impl, struct node *n)
pw_log_debug(NAME " %p: node %d is not active", impl, n->id);
return 0;
}
if (n->moving) {
pw_log_debug(NAME " %p: node %d is moving", impl, n->id);
return 0;
}
if (n->type == NODE_TYPE_DEVICE) {
configure_node(n, NULL, false);
@ -753,8 +758,10 @@ static int move_node(struct impl *impl, uint32_t source, uint32_t target)
pw_properties_parse_bool(str))
continue;
n->moving = true;
unlink_nodes(n, src_node);
link_nodes(n, dst_node);
n->moving = false;
}
return 0;
}