Commit 2ee85311 authored by Youness Alaoui's avatar Youness Alaoui

clear the retranmission timer and free the keepalive stuff if we ever update the selected pair

parent 15113873
......@@ -129,7 +129,9 @@ gboolean
component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair)
{
GSList *i;
CandidatePair result = { NULL, NULL, 0 };
CandidatePair result;
memset (&result, 0, sizeof(result));
for (i = cmp->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data;
......@@ -203,9 +205,20 @@ void component_update_selected_pair (Component *component, const CandidatePair *
g_assert (pair);
nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).",
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority);
if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source);
g_source_unref (component->selected_pair.keepalive.tick_source);
component->selected_pair.keepalive.tick_source = NULL;
}
memset (&component->selected_pair, 0, sizeof(CandidatePair));
component->selected_pair.local = pair->local;
component->selected_pair.remote = pair->remote;
component->selected_pair.priority = pair->priority;
}
/*
......@@ -287,6 +300,13 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component,
}
}
if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source);
g_source_unref (component->selected_pair.keepalive.tick_source);
component->selected_pair.keepalive.tick_source = NULL;
}
memset (&component->selected_pair, 0, sizeof(CandidatePair));
component->selected_pair.local = local;
component->selected_pair.remote = remote;
component->selected_pair.priority = priority;
......
......@@ -913,14 +913,23 @@ static GSList *priv_limit_conn_check_list_size (GSList *conncheck_list, guint up
* Changes the selected pair for the component if 'pair' is nominated
* and has higher priority than the currently selected pair. See
* ICE sect 11.1.1. "Procedures for Full Implementations" (ID-19).
*/
*/
static gboolean priv_update_selected_pair (NiceAgent *agent, Component *component, CandidateCheckPair *pair)
{
g_assert (component);
g_assert (pair);
if (pair->priority > component->selected_pair.priority) {
nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s (prio:%lu).", agent,
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority);
nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s "
"(prio:%lu).", agent, component->id, pair->local->foundation,
pair->remote->foundation, (long unsigned)pair->priority);
if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source);
g_source_unref (component->selected_pair.keepalive.tick_source);
component->selected_pair.keepalive.tick_source = NULL;
}
memset (&component->selected_pair, 0, sizeof(CandidatePair));
component->selected_pair.local = pair->local;
component->selected_pair.remote = pair->remote;
component->selected_pair.priority = pair->priority;
......
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