summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Ruprecht <cmaiku@gmail.com>2016-01-18 12:42:46 +0000
committerPhilip Withnall <philip.withnall@collabora.co.uk>2016-01-18 12:46:01 +0000
commit41ab61def82aa275649afd5f4a3fcb43e75fb360 (patch)
treeabdc41511c79c3959a9687f34fcbed23d67129e4
parent9638bc132f909177f6ecfb86cdd17af557a35c56 (diff)
downloadlibnice-41ab61def82aa275649afd5f4a3fcb43e75fb360.tar.gz
agent: Fix not setting UPnP timeout on second gather_candidates()
If the first call to nice_agent_gather_candidates() partially succeeds (setting a UPnP agent and timeout), then fails before starting gathering, a second call to nice_agent_gather_candidates() would fail to set a new UPnP timeout because the UPnP initialisation block would be skipped. That means gathering would never succeed due to timing out on UPnP. Fix that by setting the UPnP timeout whenever a new pending UPnP mapping is added. https://phabricator.freedesktop.org/T3534 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
-rw-r--r--agent/agent.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/agent/agent.c b/agent/agent.c
index 279e7cd..388e690 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2659,9 +2659,6 @@ nice_agent_gather_candidates (
agent->upnp = gupnp_simple_igd_thread_new ();
if (agent->upnp) {
- agent_timeout_add_with_context (agent, &agent->upnp_timer_source,
- "UPnP timeout", agent->upnp_timeout, priv_upnp_timeout_cb, agent);
-
g_signal_connect (agent->upnp, "mapped-external-port",
G_CALLBACK (_upnp_mapped_external_port), agent);
g_signal_connect (agent->upnp, "error-mapping-port",
@@ -2808,6 +2805,9 @@ nice_agent_gather_candidates (
0, local_ip, nice_address_get_port (base_addr),
0, PACKAGE_STRING);
agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, base_addr);
+
+ agent_timeout_add_with_context (agent, &agent->upnp_timer_source,
+ "UPnP timeout", agent->upnp_timeout, priv_upnp_timeout_cb, agent);
}
#endif