Commit 40e4ce89 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

config-policy: push endpoints with keep=true to the end of the list when sorting

This ensures that endpoints with keep=false will still have
a chance to link when ones with keep=true exist. This also effectively
means that role priority does not matter when keep=true: we keep these
links active no matter what, while policy still applies normally for
all others.

For example, a final sorted list with these endpoints will end up
looking like this:

* ep1, role priority=25, keep=false
* ep2, role priority=20, keep=false
* ep3, role priority=25, keep=true
* ep4, role priority=75, keep=true

... which will effectively cause ep1, ep3 and ep4 to be linked.
parent 729aee5c
...@@ -304,6 +304,10 @@ link_info_compare_func (gconstpointer a, gconstpointer b, gpointer data) ...@@ -304,6 +304,10 @@ link_info_compare_func (gconstpointer a, gconstpointer b, gpointer data)
guint priority_b = 0; guint priority_b = 0;
gint res = 0; gint res = 0;
res = (gint) li_a->keep - (gint) li_b->keep;
if (res != 0)
return res;
/* Get the role priority of a */ /* Get the role priority of a */
stream_a = wp_base_endpoint_get_stream (target, li_a->stream_id); stream_a = wp_base_endpoint_get_stream (target, li_a->stream_id);
if (stream_a) if (stream_a)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment