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 ...@@ -129,7 +129,9 @@ gboolean
component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair) component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair)
{ {
GSList *i; GSList *i;
CandidatePair result = { NULL, NULL, 0 }; CandidatePair result;
memset (&result, 0, sizeof(result));
for (i = cmp->local_candidates; i; i = i->next) { for (i = cmp->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data; NiceCandidate *candidate = i->data;
...@@ -203,9 +205,20 @@ void component_update_selected_pair (Component *component, const CandidatePair * ...@@ -203,9 +205,20 @@ void component_update_selected_pair (Component *component, const CandidatePair *
g_assert (pair); g_assert (pair);
nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).", nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).",
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority); 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.local = pair->local;
component->selected_pair.remote = pair->remote; component->selected_pair.remote = pair->remote;
component->selected_pair.priority = pair->priority; component->selected_pair.priority = pair->priority;
} }
/* /*
...@@ -287,6 +300,13 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component, ...@@ -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.local = local;
component->selected_pair.remote = remote; component->selected_pair.remote = remote;
component->selected_pair.priority = priority; component->selected_pair.priority = priority;
......
...@@ -919,8 +919,17 @@ static gboolean priv_update_selected_pair (NiceAgent *agent, Component *componen ...@@ -919,8 +919,17 @@ static gboolean priv_update_selected_pair (NiceAgent *agent, Component *componen
g_assert (component); g_assert (component);
g_assert (pair); g_assert (pair);
if (pair->priority > component->selected_pair.priority) { if (pair->priority > component->selected_pair.priority) {
nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s (prio:%lu).", agent, nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s "
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority); "(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.local = pair->local;
component->selected_pair.remote = pair->remote; component->selected_pair.remote = pair->remote;
component->selected_pair.priority = pair->priority; 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