summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Adam <jakub.adam@ktknet.cz>2015-09-02 16:41:48 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-09-02 16:43:21 +0100
commit88ed42619049ac1e3fe3a6e481df8aeb95033ac0 (patch)
treee6138131f7e92e2568f1f8e19b74a27921d6b694
parent10348322a960258043363e7c84e78c4821c90412 (diff)
downloadlibnice-88ed42619049ac1e3fe3a6e481df8aeb95033ac0.tar.gz
discovery: assign candidate priority after base_addr is set
Summary: So that we can take the base address into account in the calculation. Maniphest Tasks: T3324 Reviewers: pwithnall Projects: #libnice Reviewed By: pwithnall Subscribers: pwithnall Differential Revision: https://phabricator.freedesktop.org/D235
-rw-r--r--agent/discovery.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/agent/discovery.c b/agent/discovery.c
index f3a702d..882a174 100644
--- a/agent/discovery.c
+++ b/agent/discovery.c
@@ -623,6 +623,10 @@ discovery_add_server_reflexive_candidate (
candidate->component_id = component_id;
candidate->addr = *address;
+ /* step: link to the base candidate+socket */
+ candidate->sockptr = base_socket;
+ candidate->base_addr = base_socket->addr;
+
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
candidate->priority = nice_candidate_jingle_priority (candidate);
} else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
@@ -636,10 +640,6 @@ discovery_add_server_reflexive_candidate (
agent->reliable, nat_assisted);
}
- /* step: link to the base candidate+socket */
- candidate->sockptr = base_socket;
- candidate->base_addr = base_socket->addr;
-
priv_generate_candidate_credentials (agent, candidate);
priv_assign_foundation (agent, candidate);
@@ -732,6 +732,17 @@ discovery_add_relay_candidate (
candidate->addr = *address;
candidate->turn = turn_server_ref (turn);
+ /* step: link to the base candidate+socket */
+ relay_socket = nice_udp_turn_socket_new (agent->main_context, address,
+ base_socket, &turn->server,
+ turn->username, turn->password,
+ agent_to_turn_socket_compatibility (agent));
+ if (!relay_socket)
+ goto errors;
+
+ candidate->sockptr = relay_socket;
+ candidate->base_addr = base_socket->addr;
+
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
candidate->priority = nice_candidate_jingle_priority (candidate);
} else if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
@@ -745,17 +756,6 @@ discovery_add_relay_candidate (
agent->reliable, FALSE);
}
- /* step: link to the base candidate+socket */
- relay_socket = nice_udp_turn_socket_new (agent->main_context, address,
- base_socket, &turn->server,
- turn->username, turn->password,
- agent_to_turn_socket_compatibility (agent));
- if (!relay_socket)
- goto errors;
-
- candidate->sockptr = relay_socket;
- candidate->base_addr = base_socket->addr;
-
priv_generate_candidate_credentials (agent, candidate);
/* Google uses the turn username as the candidate username */