agent: transition to state gathering when restarting ice
authorFabrice Bellet <fabrice@bellet.info>
Sun, 21 Feb 2021 10:06:00 +0000 (11:06 +0100)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Fri, 5 Mar 2021 20:15:29 +0000 (20:15 +0000)
The state of the component is downgraded to gathering state, so it can
really restart a new conncheck from scratch. It'll transition to state
connecting when receiving the updated remote candidates.

agent/agent.c
agent/stream.c

index a1dc930..1756734 100644 (file)
@@ -2599,7 +2599,10 @@ void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, gui
             TRANSITION (DISCONNECTED, CONNECTING) ||
             /* If a tcp socket of connected pair is disconnected, in
              * conn_check_prune_socket(): */
-            TRANSITION (CONNECTED, CONNECTING));
+            TRANSITION (CONNECTED, CONNECTING) ||
+            /* with ICE restart in nice_stream_restart() */
+            TRANSITION (CONNECTED, GATHERING) ||
+            TRANSITION (READY, GATHERING));
 
 #undef TRANSITION
 
@@ -5562,8 +5565,8 @@ nice_agent_restart_stream (
     goto done;
   }
 
-  /* step: reset local credentials for the stream and
-   * clean up the list of remote candidates */
+  /* step: reset local credentials for the stream,
+   * clean up the list of candidates, and the conncheck list */
   nice_stream_restart (stream, agent);
 
   res = TRUE;
index 2ec4feb..08a7dad 100644 (file)
@@ -139,6 +139,8 @@ nice_stream_restart (NiceStream *stream, NiceAgent *agent)
     NiceComponent *component = i->data;
 
     nice_component_restart (component);
+    agent_signal_component_state_change (agent,
+        stream->id, component->id, NICE_COMPONENT_STATE_GATHERING);
   }
 }