conncheck: add a missing component state transition
authorFabrice Bellet <fabrice@bellet.info>
Sun, 17 May 2020 21:08:12 +0000 (23:08 +0200)
committerFabrice Bellet <fabrice@bellet.info>
Mon, 18 May 2020 13:21:45 +0000 (15:21 +0200)
When reactivating a high priority pair, we have to change back the
component state from ready to connected, since there is a new pair to be
tested.

The case of the succeeded pair is also a bit simplified, the invocation
of the function conn_check_update_check_list_state_for_ready() to
complete the ready - connected - ready flip-flop transition is not
required for the trickle test any longer.

agent/conncheck.c

index ee12527..f2839bb 100644 (file)
@@ -3166,20 +3166,20 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
                   agent_signal_component_state_change (agent, stream->id,
                       component->id, NICE_COMPONENT_STATE_CONNECTING);
                   conn_check_schedule_next (agent);
+                /* If the component if in ready state, move it back to
+                 * connected as this failed pair with a higher priority
+                 * than the nominated pair requires to pursue the
+                 * conncheck
+                 */
+                } else if (component->state == NICE_COMPONENT_STATE_READY) {
+                  agent_signal_component_state_change (agent, stream->id,
+                      component->id, NICE_COMPONENT_STATE_CONNECTED);
+                  conn_check_schedule_next (agent);
                 }
             }
             break;
          case NICE_CHECK_SUCCEEDED:
             nice_debug ("Agent %p : nothing to do for pair %p.", agent, p);
-            /* note: this is a bit unsure corner-case -- let's do the
-               same state update as for processing responses to our own checks */
-            /* note: this update is required by the trickle test, to
-             * ensure the transition ready -> connected -> ready, because
-             * an incoming stun request generates a discovered peer reflexive,
-             * that causes the ready -> connected transition.
-             */
-            conn_check_update_check_list_state_for_ready (agent, stream,
-                component);
             break;
           default:
             break;