Commit 0c142b36 authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Olivier Crête
Browse files

conncheck: enable retransmit flag after nominated pair reordering

When an existing peer-reflexive remote candidate is updated to a server
reflexive one, due to the late reception of remove candidates, this
update has several consequences on the conncheck list:

 - pair foundations and priorities must be recomputed
 - the highest nominated pair may have changed too
 - this is not strictly required, but some pairs that had *a lower*
   priority than the previously peer-reflexive nominated pair, had
   their retransmit flag set to false, for this reason. These pairs may
   now have *a higher* priority than the newly promoted nominated pair,
   and it is fair in that case to turn their retransmit flag back to
   true.
parent 1da0537b
......@@ -3692,6 +3692,7 @@ static gboolean priv_add_remote_candidate (
"priority nominated pair %p.", agent, pair);
conn_check_update_selected_pair (agent, component, pair);
}
conn_check_update_retransmit_flag (agent, stream_id, component_id);
}
else {
/* case 2: add a new candidate */
......
......@@ -2215,6 +2215,38 @@ conn_check_update_selected_pair (NiceAgent *agent, NiceComponent *component,
}
}
/*
* Update the retransmit flag of pairs with higher priority than
* the first nominated pair
*/
void
conn_check_update_retransmit_flag (NiceAgent *agent, guint stream_id,
guint component_id)
{
NiceStream *stream;
NiceComponent *component;
CandidateCheckPair *pair;
GSList *i;
if (agent_find_component (agent, stream_id, component_id, &stream,
&component)) {
for (i = stream->conncheck_list; i; i = i->next) {
pair = i->data;
if (pair->component_id != component_id)
continue;
if (pair->nominated)
break;
if (pair->state == NICE_CHECK_IN_PROGRESS && !pair->retransmit &&
pair->stun_transactions) {
pair->retransmit = TRUE;
nice_debug ("Agent %p : pair %p will be retransmitted.", agent, pair);
}
}
}
return;
}
/*
* Updates the check list state.
*
......
......@@ -121,6 +121,8 @@ conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *co
void recalculate_pair_priorities (NiceAgent *agent);
void conn_check_update_selected_pair (NiceAgent *agent,
NiceComponent *component, CandidateCheckPair *pair);
void conn_check_update_retransmit_flag (NiceAgent *agent, guint stream_id,
guint component_id);
#endif /*_NICE_CONNCHECK_H */
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