Commit ee3c8082 authored by Youness Alaoui's avatar Youness Alaoui Committed by Olivier Crête

Make socket reliable in case of tcp-act/tcp-pass and move logic for ms-turn

parent cdb7cad9
...@@ -1801,7 +1801,10 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -1801,7 +1801,10 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
/* MS-TURN will allocate a transport with the same protocol it received /* 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 * 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 * will be TCP-ACT/TCP-PASS which means it will be reliable all the way
* to the peer * to the peer.
* [MS-TURN] : The transport address has the same transport protocol
* over which the Allocate request was received; a request that is
* received over TCP returns a TCP allocated transport address.
*/ */
if (agent->compatibility == NICE_COMPATIBILITY_OC2007 || if (agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
agent->compatibility == NICE_COMPATIBILITY_OC2007R2) agent->compatibility == NICE_COMPATIBILITY_OC2007R2)
......
...@@ -2504,13 +2504,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -2504,13 +2504,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
} }
nice_address_set_from_sockaddr (&niceaddr, &relayaddr.addr); nice_address_set_from_sockaddr (&niceaddr, &relayaddr.addr);
if ((agent->compatibility == NICE_COMPATIBILITY_OC2007 || if (nice_socket_is_reliable (d->nicesock)) {
agent->compatibility == NICE_COMPATIBILITY_OC2007R2) &&
(d->turn->type == NICE_RELAY_TYPE_TURN_TCP ||
d->turn->type == NICE_RELAY_TYPE_TURN_TLS)) {
/* [MS-TURN] : The transport address has the same transport protocol
* over which the Allocate request was received; a request that is
* received over TCP returns a TCP allocated transport address.*/
relay_cand = discovery_add_relay_candidate ( relay_cand = discovery_add_relay_candidate (
d->agent, d->agent,
d->stream->id, d->stream->id,
...@@ -2521,10 +2515,15 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -2521,10 +2515,15 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
d->turn); d->turn);
if (relay_cand) { if (relay_cand) {
nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr, if (agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
&d->stun_message); agent->compatibility == NICE_COMPATIBILITY_OC2007R2) {
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr, nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr,
resp); &d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp);
} else {
priv_add_new_turn_refresh (d, relay_cand, lifetime);
}
} }
relay_cand = discovery_add_relay_candidate ( relay_cand = discovery_add_relay_candidate (
...@@ -2559,8 +2558,9 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -2559,8 +2558,9 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
&d->stun_message); &d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr, nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp); resp);
} else } else {
priv_add_new_turn_refresh (d, relay_cand, lifetime); priv_add_new_turn_refresh (d, relay_cand, lifetime);
}
} }
d->stun_message.buffer = NULL; d->stun_message.buffer = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment