agent: set component is state gathering earlier
authorFabrice Bellet <fabrice@bellet.info>
Mon, 1 Jun 2020 19:40:59 +0000 (21:40 +0200)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Mon, 14 Dec 2020 16:56:39 +0000 (16:56 +0000)
This patch avoids to bypass state gathering, with transition
from disconnected to connecting.

agent/agent.c
agent/discovery.c

index 2145755..2524ec2 100644 (file)
@@ -3497,6 +3497,11 @@ nice_agent_gather_candidates (
       ret = FALSE;
       goto error;
     }
+
+    if (component->state == NICE_COMPONENT_STATE_DISCONNECTED ||
+        component->state == NICE_COMPONENT_STATE_FAILED)
+      agent_signal_component_state_change (agent,
+          stream->id, component->id, NICE_COMPONENT_STATE_GATHERING);
   }
 
   stream->gathering = TRUE;
index 7f2d13c..0ca0041 100644 (file)
@@ -1209,16 +1209,6 @@ static gboolean priv_discovery_tick_unlocked (NiceAgent *agent)
       if (nice_address_is_valid (&cand->server) &&
           (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
               cand->type == NICE_CANDIDATE_TYPE_RELAYED)) {
-        NiceComponent *component;
-
-        if (agent_find_component (agent, cand->stream_id,
-                cand->component_id, NULL, &component) &&
-            (component->state == NICE_COMPONENT_STATE_DISCONNECTED ||
-                component->state == NICE_COMPONENT_STATE_FAILED))
-          agent_signal_component_state_change (agent,
-                                              cand->stream_id,
-                                              cand->component_id,
-                                              NICE_COMPONENT_STATE_GATHERING);
 
         if (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE) {
           buffer_len = stun_usage_bind_create (&cand->stun_agent,