diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2019-07-29 21:35:04 +0000 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2019-07-29 21:35:04 +0000 |
commit | acda4a08d06af957fc88139884e9340c09bdcfd3 (patch) | |
tree | 82e9b4dfb658cd326838c97bc58da00d88fda817 | |
parent | 1607f9209d0db3112a1b6906828362f2ec9874d2 (diff) | |
download | libnice-acda4a08d06af957fc88139884e9340c09bdcfd3.tar.gz |
agent: fix a regression when updating foundations
A previous commit c1fb6f2 introduced a regression in the way the
foundation of a selected pair is updated and signaled, when the
foundation of its remote candidate changes. The previous comparison was
made on *always* identical strings, so the update of the selected pair
was *never* signaled.
-rw-r--r-- | agent/agent.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/agent/agent.c b/agent/agent.c index 0900607..917c18f 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -3487,21 +3487,24 @@ static void priv_update_pair_foundations (NiceAgent *agent, GSList *i; for (i = stream->conncheck_list; i; i = i->next) { CandidateCheckPair *pair = i->data; - if (pair->remote == remote && - (strncmp (pair->remote->foundation, remote->foundation, - NICE_CANDIDATE_MAX_FOUNDATION))) { - g_snprintf (pair->foundation, - NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", + if (pair->remote == remote) { + gchar foundation[NICE_CANDIDATE_PAIR_MAX_FOUNDATION]; + g_snprintf (foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", pair->local->foundation, pair->remote->foundation); - nice_debug ("Agent %p : Updating pair %p foundation to '%s'", - agent, pair, pair->foundation); - if (component->selected_pair.local == pair->local && - component->selected_pair.remote == pair->remote) { - nice_debug ("Agent %p : updating SELECTED PAIR for component " - "%u: %s:%s (prio:%" G_GUINT64_FORMAT ").", agent, component->id, - pair->local->foundation, pair->remote->foundation, pair->priority); - agent_signal_new_selected_pair (agent, pair->stream_id, component->id, - pair->local, pair->remote); + if (strncmp (pair->foundation, foundation, + NICE_CANDIDATE_PAIR_MAX_FOUNDATION)) { + g_strlcpy (pair->foundation, foundation, + NICE_CANDIDATE_PAIR_MAX_FOUNDATION); + nice_debug ("Agent %p : Updating pair %p foundation to '%s'", + agent, pair, pair->foundation); + if (component->selected_pair.local == pair->local && + component->selected_pair.remote == pair->remote) { + nice_debug ("Agent %p : updating SELECTED PAIR for component " + "%u: %s (prio:%" G_GUINT64_FORMAT ").", agent, + component->id, foundation, pair->priority); + agent_signal_new_selected_pair (agent, pair->stream_id, + component->id, pair->local, pair->remote); + } } } } |