Commit 55d80fca authored by Youness Alaoui's avatar Youness Alaoui

Do a proper turn allocate for relayed candidates during the discovery

parent 0ccf0d7c
...@@ -586,8 +586,9 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) ...@@ -586,8 +586,9 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
g_debug ("Agent %p : discovery - scheduling cand type %u addr %s and socket %d.\n", agent, g_debug ("Agent %p : discovery - scheduling cand type %u addr %s and socket %d.\n", agent,
cand->type, cand->server_addr, cand->socket); cand->type, cand->server_addr, cand->socket);
if (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE && if (cand->server_addr &&
cand->server_addr) { (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
cand->type == NICE_CANDIDATE_TYPE_RELAYED)) {
NiceAddress stun_server; NiceAddress stun_server;
/* XXX FIXME TODO: handle error here?! Kai, help me! */ /* XXX FIXME TODO: handle error here?! Kai, help me! */
...@@ -600,8 +601,15 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) ...@@ -600,8 +601,15 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
cand->component->id, cand->component->id,
NICE_COMPONENT_STATE_GATHERING); NICE_COMPONENT_STATE_GATHERING);
if (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE) {
buffer_len = stun_usage_bind_create (&agent->stun_agent, buffer_len = stun_usage_bind_create (&agent->stun_agent,
&cand->stun_message, cand->stun_buffer, sizeof(cand->stun_buffer)); &cand->stun_message, cand->stun_buffer, sizeof(cand->stun_buffer));
} else if (cand->type == NICE_CANDIDATE_TYPE_RELAYED) {
buffer_len = stun_usage_turn_create (&agent->stun_agent,
agent->turn_username, strlen (agent->turn_username),
agent->turn_password, strlen (agent->turn_password),
&cand->stun_message, cand->stun_buffer, sizeof(cand->stun_buffer));
}
if (buffer_len > 0) { if (buffer_len > 0) {
stun_timer_start (&cand->timer); stun_timer_start (&cand->timer);
......
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