Commit 10d4756b authored by Youness Alaoui's avatar Youness Alaoui

Fix stun discovery timeout

parent be44f5c2
...@@ -530,7 +530,6 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) ...@@ -530,7 +530,6 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
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));
if (buffer_len > 0) { if (buffer_len > 0) {
stun_timer_start (&cand->timer); stun_timer_start (&cand->timer);
...@@ -566,13 +565,14 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) ...@@ -566,13 +565,14 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
cand->done = TRUE; cand->done = TRUE;
} }
else if (priv_timer_expired (&cand->next_tick, &now)) { else if (priv_timer_expired (&cand->next_tick, &now)) {
switch (stun_timer_refresh (&cand->timer)) { int timeout = stun_timer_refresh (&cand->timer);
switch (timeout) {
case -1: case -1:
/* case: error, abort processing */ /* case: error, abort processing */
cand->done = TRUE; cand->done = TRUE;
cand->stun_message.buffer = NULL; cand->stun_message.buffer = NULL;
cand->stun_message.buffer_len = 0; cand->stun_message.buffer_len = 0;
g_debug ("Agent %p : Error with stun_bind_elapse(), aborting discovery item.", agent); g_debug ("Agent %p : bind discovery timed out, aborting discovery item.", agent);
break; break;
case 0: case 0:
{ {
...@@ -599,13 +599,21 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) ...@@ -599,13 +599,21 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
++not_done; /* note: retry later */ ++not_done; /* note: retry later */
break; break;
} }
} default:
{
cand->next_tick = now;
g_time_val_add (&cand->next_tick, timeout * 1000);
++not_done; /* note: retry later */
break;
} }
else }
} else {
++not_done; /* note: discovery not expired yet */ ++not_done; /* note: discovery not expired yet */
} }
} }
}
if (not_done == 0) { if (not_done == 0) {
g_debug ("Agent %p : Candidate gathering FINISHED, stopping discovery timer.", agent); g_debug ("Agent %p : Candidate gathering FINISHED, stopping discovery timer.", agent);
......
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