Skip to content

Commit

Permalink
modules/rtpengine: set_rtpengine_set fix
Browse files Browse the repository at this point in the history
(cherry picked from commit fe6614f)
  • Loading branch information
juha-h authored and miconda committed Sep 24, 2019
1 parent ccf16cb commit c63d048
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/rtpengine/rtpengine.c
Expand Up @@ -2922,6 +2922,15 @@ select_rtpp_node_old(str callid, str viabranch, int do_test, enum rtpe_operation
return node;
}

unsigned int node_in_set(struct rtpp_node *node, struct rtpp_set *set) {
struct rtpp_node *current = set->rn_first;
while (current) {
if (current->idx == node->idx) return 1;
current = current->rn_next;
}
return 0;
}

/*
* Main balancing routine. This DO try to keep the same proxy for
* the call if some proxies were disabled or enabled (e.g. kamctl command)
Expand Down Expand Up @@ -2950,7 +2959,7 @@ select_rtpp_node(str callid, str viabranch, int do_test, struct rtpp_node **quer
node = select_rtpp_node_old(callid, viabranch, do_test, op);

// check node
if (!node) {
if (!node || (node_in_set(node, active_rtpp_set) == 0)) {
// run the selection algorithm
node = select_rtpp_node_new(callid, viabranch, do_test, queried_nodes_ptr, queried_nodes);

Expand Down

0 comments on commit c63d048

Please sign in to comment.