Commit dbffdfc1 authored by Youness Alaoui's avatar Youness Alaoui

by Olivier Crete : Really return the next available foundation

parent 471708b2
...@@ -679,21 +679,26 @@ discovery_add_peer_reflexive_candidate ( ...@@ -679,21 +679,26 @@ discovery_add_peer_reflexive_candidate (
static guint priv_highest_remote_foundation (Component *component) static guint priv_highest_remote_foundation (Component *component)
{ {
GSList *i; GSList *i;
guint highest = 0; guint highest = 1;
gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION]; gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION];
for (;;) { for (highest = 1;; highest++) {
gboolean taken = FALSE;
g_snprintf (foundation, NICE_CANDIDATE_MAX_FOUNDATION, "%u", highest); g_snprintf (foundation, NICE_CANDIDATE_MAX_FOUNDATION, "%u", highest);
for (i = component->remote_candidates; i; i = i->next) { for (i = component->remote_candidates; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidate *cand = i->data;
if (strncmp (foundation, cand->foundation, if (strncmp (foundation, cand->foundation,
NICE_CANDIDATE_MAX_FOUNDATION) != 0) { NICE_CANDIDATE_MAX_FOUNDATION) == 0) {
return highest; taken = TRUE;
break;
} }
} }
if (!taken)
return highest;
} }
return highest; g_return_val_if_reached (highest);
} }
/* /*
......
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