summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2014-04-09 20:35:33 -0400
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2014-05-15 09:44:00 -0400
commit2929c8fa4c70ae371c6fc9f6d67530fe92bdf304 (patch)
tree4f4406d922e4de6e1e43b8cc955bf46810255f9e
parent3e1f286f24f5f0b9c9817320f0a85605b2e2035e (diff)
downloadlibnice-2929c8fa4c70ae371c6fc9f6d67530fe92bdf304.tar.gz
Use reliable TCP for ms-turn since it generates tcp candidates
-rw-r--r--agent/agent.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/agent/agent.c b/agent/agent.c
index 05baba7..1d96675 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -1796,14 +1796,24 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
cdisco->nicesock = nicesock;
} else {
NiceAddress proxy_server;
- nicesock = NULL;
+ gboolean reliable_tcp = FALSE;
+
+ /* MS-TURN will allocate a transport with the same protocol it received
+ * the allocate request. So if we are connecting in TCP, then the candidate
+ * will be TCP-ACT/TCP-PASS which means it will be reliable all the way
+ * to the peer
+ */
+ if (agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
+ agent->compatibility == NICE_COMPATIBILITY_OC2007R2)
+ reliable_tcp = TRUE;
+ nicesock = NULL;
if (agent->proxy_type != NICE_PROXY_TYPE_NONE &&
agent->proxy_ip != NULL &&
nice_address_set_from_string (&proxy_server, agent->proxy_ip)) {
nice_address_set_port (&proxy_server, agent->proxy_port);
nicesock = nice_tcp_bsd_socket_new (agent->main_context, &proxy_server,
- FALSE);
+ reliable_tcp);
if (nicesock) {
_priv_set_socket_tos (agent, nicesock, stream->tos);
@@ -1822,7 +1832,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
}
if (nicesock == NULL) {
nicesock = nice_tcp_bsd_socket_new (agent->main_context, &turn->server,
- FALSE);
+ reliable_tcp);
if (nicesock)
_priv_set_socket_tos (agent, nicesock, stream->tos);