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,
/* 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
* 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 ||
agent->compatibility == NICE_COMPATIBILITY_OC2007R2)
......
......@@ -2504,13 +2504,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
}
nice_address_set_from_sockaddr (&niceaddr, &relayaddr.addr);
if ((agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
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.*/
if (nice_socket_is_reliable (d->nicesock)) {
relay_cand = discovery_add_relay_candidate (
d->agent,
d->stream->id,
......@@ -2521,10 +2515,15 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
d->turn);
if (relay_cand) {
if (agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
agent->compatibility == NICE_COMPATIBILITY_OC2007R2) {
nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr,
&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 (
......@@ -2559,9 +2558,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
&d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp);
} else
} else {
priv_add_new_turn_refresh (d, relay_cand, lifetime);
}
}
d->stun_message.buffer = NULL;
d->stun_message.buffer_len = 0;
......
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