summaryrefslogtreecommitdiff
path: root/agent/agent.c
diff options
context:
space:
mode:
authorJakub Adam <jakub.adam@ktknet.cz>2017-04-02 17:08:07 +0200
committerPhilip Withnall <withnall@endlessm.com>2017-04-03 10:48:30 +0100
commit4c79b8659da1a627463b5b66c56ddf863801aaab (patch)
tree355adf8b14cfcd3ff407c56c5f1e16ba4378f387 /agent/agent.c
parent3c20e78fcd653a2db67f03c16d270beda2763a30 (diff)
downloadlibnice-4c79b8659da1a627463b5b66c56ddf863801aaab.tar.gz
agent: Only try to use the address of the same family to connect to TURN
Using a IPv6 local address to connect to a IPv4 relay just creates an extra discovery attempt that will not provide something useful. This commit fixes another place of TURN discovery creation which was omitted in fc0d3744ebc03f8137866170594968ba61e6be30. In my case it cuts down up to ~15 seconds from candidate gathering phase, making it almost instantaneous. Reviewed-by: Olivier CrĂȘte <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D1709
Diffstat (limited to 'agent/agent.c')
-rw-r--r--agent/agent.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/agent/agent.c b/agent/agent.c
index 4f9d1ba..58e4a11 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2870,10 +2870,15 @@ nice_agent_gather_candidates (
if (agent->full_mode && component &&
transport != NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE) {
GList *item;
+ int host_ip_version = nice_address_ip_version (&host_candidate->addr);
for (item = component->turn_servers; item; item = item->next) {
TurnServer *turn = item->data;
+ if (host_ip_version != nice_address_ip_version (&turn->server)) {
+ continue;
+ }
+
priv_add_new_candidate_discovery_turn (agent,
host_candidate->sockptr,
turn,