diff options
author | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2015-01-20 12:31:11 -0500 |
---|---|---|
committer | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2015-01-20 12:34:04 -0500 |
commit | e4b8707d4ada89d09d9513775f165bd6c1481e1e (patch) | |
tree | 2e5ff667e49de1ff904218b267814a19fc6eb9e9 /agent | |
parent | 641225708f185b3a1304d59a895c057dadec16b3 (diff) | |
download | libnice-e4b8707d4ada89d09d9513775f165bd6c1481e1e.tar.gz |
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
Diffstat (limited to 'agent')
-rw-r--r-- | agent/agent.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/agent/agent.c b/agent/agent.c index c0efd76..d9900ae 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -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++) |