summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2014-10-02 18:41:14 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2014-10-09 16:26:07 -0400
commit6919a4d36efe6312bdac47f8775e4e5bd9e1d801 (patch)
tree801d11ce68f23522d24d4a845ae74628eb4312a2
parente01b3e026d523e9ae7ccd6b23632f9e0cad315a4 (diff)
conncheck: Insert peer reflexive pair sorted
The rest of the list is sorted, but this was just appended, making it likely to be dropped if the list grows too long.
-rw-r--r--agent/conncheck.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 783a977..845ddae 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -2165,7 +2165,6 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair);
Stream *stream = agent_find_stream (agent, stream_id);
- stream->conncheck_list = g_slist_append (stream->conncheck_list, pair);
pair->agent = agent;
pair->stream_id = stream_id;
pair->component_id = component_id;;
@@ -2186,6 +2185,9 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
pair->controlling = agent->controlling_mode;
nice_debug ("Agent %p : added a new peer-discovered pair with foundation of '%s'.", agent, pair->foundation);
+ stream->conncheck_list = g_slist_insert_sorted (stream->conncheck_list, pair,
+ (GCompareFunc)conn_check_compare);
+
return pair;
}