Multi rule
This commit is contained in:
parent
f3e40a7d91
commit
fb176a40b0
1 changed files with 43 additions and 27 deletions
|
|
@ -925,21 +925,24 @@ void Client::Impl::EnforceRulesForLink(uint32_t link_id, uint32_t out_port,
|
|||
auto node_it = nodes.find(src_node_id);
|
||||
if (node_it == nodes.end()) return;
|
||||
|
||||
std::vector<uint32_t> rule_target_ids;
|
||||
for (const auto& rule_entry : route_rules) {
|
||||
if (!MatchesRule(node_it->second, rule_entry.second.match)) continue;
|
||||
|
||||
uint32_t target_node_id = 0;
|
||||
for (const auto& n : nodes) {
|
||||
if (n.second.name == rule_entry.second.target_node) {
|
||||
target_node_id = n.first;
|
||||
rule_target_ids.push_back(n.first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (target_node_id == 0) return;
|
||||
}
|
||||
if (rule_target_ids.empty()) return;
|
||||
|
||||
auto in_port_it = ports.find(in_port);
|
||||
if (in_port_it == ports.end()) return;
|
||||
if (in_port_it->second.node.value == target_node_id) return;
|
||||
uint32_t dest_node_id = in_port_it->second.node.value;
|
||||
for (uint32_t tid : rule_target_ids) {
|
||||
if (dest_node_id == tid) return;
|
||||
}
|
||||
|
||||
if (link_proxies.count(link_id)) return;
|
||||
for (const auto& proxy : auto_link_proxies) {
|
||||
|
|
@ -958,8 +961,6 @@ void Client::Impl::EnforceRulesForLink(uint32_t link_id, uint32_t out_port,
|
|||
}
|
||||
|
||||
pw_registry_destroy(registry, link_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Client::Impl::SchedulePolicySync() {
|
||||
|
|
@ -1079,6 +1080,21 @@ void Client::Impl::ProcessPendingAutoLinks() {
|
|||
if (!is_ours) {
|
||||
if (link_proxies.count(link_id)) is_ours = true;
|
||||
}
|
||||
if (!is_ours) {
|
||||
uint32_t out_port = link_entry.second.output_port.value;
|
||||
for (const auto& proxy : auto_link_proxies) {
|
||||
if (proxy && proxy->output_port == out_port &&
|
||||
proxy->input_port == in_port) { is_ours = true; break; }
|
||||
}
|
||||
}
|
||||
if (!is_ours) {
|
||||
uint32_t out_port = link_entry.second.output_port.value;
|
||||
for (const auto& pair : auto_link_claimed_pairs) {
|
||||
if (pair.first == out_port && pair.second == in_port) {
|
||||
is_ours = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_ours) {
|
||||
uint32_t out_port = link_entry.second.output_port.value;
|
||||
for (const auto& proxy : saved_link_proxies) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue