From 4c79b8659da1a627463b5b66c56ddf863801aaab Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Sun, 2 Apr 2017 17:08:07 +0200 Subject: [PATCH] agent: Only try to use the address of the same family to connect to TURN MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Differential Revision: https://phabricator.freedesktop.org/D1709 --- agent/agent.c | 5 +++++ 1 file changed, 5 insertions(+) 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, -- 2.7.4