diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2020-05-17 22:51:21 +0200 |
---|---|---|
committer | Fabrice Bellet <fabrice@bellet.info> | 2020-05-18 15:21:20 +0200 |
commit | 6bbeba279ed923749fc600a7902f15f2298e29ed (patch) | |
tree | c01d1b10293a0cd2672dae49b1900e50700cac4e | |
parent | 72ccb1a23649c6e9dd956f8cae0f23cc5ac525cd (diff) | |
download | libnice-6bbeba279ed923749fc600a7902f15f2298e29ed.tar.gz |
conncheck: handle the consequence when a pair is not created
Since commit fcd6bc86 a pair is not always created, when its priority
is lower than the selected pair priority. We have to deal with this
possibility when calling the function priv_add_new_check_pair().
More precisely, the component state update really requires the addition
of a new pair.
-rw-r--r-- | agent/conncheck.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c index e726d7a..690f63e 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -2423,17 +2423,19 @@ static CandidateCheckPair *priv_conn_check_add_for_candidate_pair_matched ( pair = priv_add_new_check_pair (agent, stream_id, component, local, remote, initial_state); - if (component->state == NICE_COMPONENT_STATE_CONNECTED || - component->state == NICE_COMPONENT_STATE_READY) { - agent_signal_component_state_change (agent, - stream_id, - component->id, - NICE_COMPONENT_STATE_CONNECTED); - } else { - agent_signal_component_state_change (agent, - stream_id, - component->id, - NICE_COMPONENT_STATE_CONNECTING); + if (pair) { + if (component->state == NICE_COMPONENT_STATE_CONNECTED || + component->state == NICE_COMPONENT_STATE_READY) { + agent_signal_component_state_change (agent, + stream_id, + component->id, + NICE_COMPONENT_STATE_CONNECTED); + } else { + agent_signal_component_state_change (agent, + stream_id, + component->id, + NICE_COMPONENT_STATE_CONNECTING); + } } return pair; @@ -2468,9 +2470,9 @@ gboolean conn_check_add_for_candidate_pair (NiceAgent *agent, /* note: match pairs only if transport and address family are the same */ if (local->transport == conn_check_match_transport (remote->transport) && local->addr.s.addr.sa_family == remote->addr.s.addr.sa_family) { - priv_conn_check_add_for_candidate_pair_matched (agent, stream_id, component, - local, remote, NICE_CHECK_FROZEN); - ret = TRUE; + if (priv_conn_check_add_for_candidate_pair_matched (agent, stream_id, + component, local, remote, NICE_CHECK_FROZEN)) + ret = TRUE; } return ret; |