Commit d31cc436 authored by Youness Alaoui's avatar Youness Alaoui

do not search for local/remote candidates using the username if we are not in...

do not search for local/remote candidates using the username if we are not in google/msn mode because for draft19, the username is global, not per candidate
parent bcb6fb53
...@@ -2358,41 +2358,44 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -2358,41 +2358,44 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
} }
} }
/* We need to find which local candidate was used */ if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE ||
for (i = component->remote_candidates; i; i = i->next) { agent->compatibility == NICE_COMPATIBILITY_MSN) {
for (j = component->local_candidates; j; j = j->next) { /* We need to find which local candidate was used */
gboolean inbound = TRUE; for (i = component->remote_candidates; i; i = i->next) {
NiceCandidate *rcand = i->data; for (j = component->local_candidates; j; j = j->next) {
NiceCandidate *lcand = j->data; gboolean inbound = TRUE;
NiceCandidate *rcand = i->data;
/* If we receive a response, then the username is local:remote */ NiceCandidate *lcand = j->data;
if (agent->compatibility != NICE_COMPATIBILITY_MSN) {
if (stun_message_get_class (&req) == STUN_REQUEST || /* If we receive a response, then the username is local:remote */
stun_message_get_class (&req) == STUN_INDICATION) { if (agent->compatibility != NICE_COMPATIBILITY_MSN) {
inbound = TRUE; if (stun_message_get_class (&req) == STUN_REQUEST ||
} else { stun_message_get_class (&req) == STUN_INDICATION) {
inbound = FALSE; inbound = TRUE;
} else {
inbound = FALSE;
}
} }
}
uname_len = priv_create_username (agent, stream, uname_len = priv_create_username (agent, stream,
component->id, rcand, lcand, component->id, rcand, lcand,
uname, sizeof (uname), inbound); uname, sizeof (uname), inbound);
stun_debug ("Comparing username '"); stun_debug ("Comparing username '");
stun_debug_bytes (username, username? username_len : 0); stun_debug_bytes (username, username? username_len : 0);
stun_debug ("' (%d) with '", username_len); stun_debug ("' (%d) with '", username_len);
stun_debug_bytes (uname, uname_len); stun_debug_bytes (uname, uname_len);
stun_debug ("' (%d) : %d\n", stun_debug ("' (%d) : %d\n",
uname_len, username && uname_len == username_len && uname_len, username && uname_len == username_len &&
memcmp (username, uname, uname_len) == 0); memcmp (username, uname, uname_len) == 0);
if (username && if (username &&
uname_len == username_len && uname_len == username_len &&
memcmp (uname, username, username_len) == 0) { memcmp (uname, username, username_len) == 0) {
local_candidate = lcand; local_candidate = lcand;
remote_candidate2 = rcand; remote_candidate2 = rcand;
break; break;
}
} }
} }
} }
...@@ -2465,7 +2468,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -2465,7 +2468,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
"peer-reflexive candidate.", agent); "peer-reflexive candidate.", agent);
remote_candidate = discovery_learn_remote_peer_reflexive_candidate ( remote_candidate = discovery_learn_remote_peer_reflexive_candidate (
agent, stream, component, priority, from, socket, agent, stream, component, priority, from, socket,
local_candidate, remote_candidate2); local_candidate,
remote_candidate2 ? remote_candidate2 : remote_candidate);
} }
priv_reply_to_conn_check (agent, stream, component, remote_candidate, priv_reply_to_conn_check (agent, stream, component, remote_candidate,
......
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