Commit e4b8707d authored by Youness Alaoui's avatar Youness Alaoui
Browse files

Only change the receiving nicesock for udp-turn for ice-tcp

The code was in the wrong spot, for OC2007, we need to fix the
nicesock used only in the case of udp-turn-over-tcp for OC2007
compatibility mode. With the current code, it was thinking that
the data came from TURN for every udp packet.
This should hopefully fix : https://github.com/EricssonResearch/openwebrtc/issues/85
parent 64122570
......@@ -3276,7 +3276,6 @@ agent_recv_message_unlocked (
{
NiceAddress from;
GList *item;
GSList *cand_i;
gint retval;
/* We need an address for packet parsing, below. */
......@@ -3284,25 +3283,6 @@ agent_recv_message_unlocked (
message->from = &from;
}
/* In case of ICE-TCP on UDP-TURN (OC2007 compat), we need to do the recv
* on the UDP_TURN socket, but it's possible we receive the source event on
* the UDP_TURN_OVER_TCP socket, so in that case, we need to replace the
* socket we do the recv on to the topmost socket
*/
for (cand_i = component->local_candidates; cand_i; cand_i = cand_i->next) {
NiceCandidate *cand = cand_i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->stream_id == stream->id &&
cand->component_id == component->id &&
((NiceSocket *)cand->sockptr)->fileno == nicesock->fileno) {
nice_debug ("Agent %p : Packet received from a TURN socket.",
agent);
nicesock = cand->sockptr;
break;
}
}
/* ICE-TCP requires that all packets be framed with RFC4571 */
if (nice_socket_is_reliable (nicesock)) {
/* In the case of OC2007 and OC2007R2 which uses UDP TURN for TCP-ACTIVE
......@@ -3310,12 +3290,31 @@ agent_recv_message_unlocked (
* always return an entire frame, so we must read it as is */
if (nicesock->type == NICE_SOCKET_TYPE_UDP_TURN_OVER_TCP ||
nicesock->type == NICE_SOCKET_TYPE_UDP_TURN) {
GSList *cand_i;
GInputVector *local_bufs;
NiceInputMessage local_message;
guint n_bufs = 0;
guint16 rfc4571_frame;
guint i;
/* In case of ICE-TCP on UDP-TURN (OC2007 compat), we need to do the recv
* on the UDP_TURN socket, but it's possible we receive the source event
* on the UDP_TURN_OVER_TCP socket, so in that case, we need to replace
* the socket we do the recv on to the topmost socket
*/
for (cand_i = component->local_candidates; cand_i; cand_i = cand_i->next) {
NiceCandidate *cand = cand_i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->stream_id == stream->id &&
cand->component_id == component->id &&
((NiceSocket *)cand->sockptr)->fileno == nicesock->fileno) {
nice_debug ("Agent %p : Packet received from a TURN socket.",
agent);
nicesock = cand->sockptr;
break;
}
}
/* Count the number of buffers. */
if (message->n_buffers == -1) {
for (i = 0; message->buffers[i].buffer != NULL; i++)
......
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