From b72b9153d91a93a550c4ec40fce5f9a18e7eaac6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Sun, 20 Sep 2015 16:53:26 -0400 Subject: [PATCH] agent: Restrict transitions to gathering Only allow transitions to gathering from disconnected or failed states. --- agent/agent.c | 2 ++ agent/discovery.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/agent/agent.c b/agent/agent.c index fb4a7b1..109a0cd 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -2149,6 +2149,8 @@ void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, gui /* If set_remote_candidates() is called with new candidates after * reaching FAILED: */ TRANSITION (FAILED, CONNECTING) || + /* if new relay servers are added to a failed connection */ + TRANSITION (FAILED, GATHERING) || /* Possible by calling set_remote_candidates() without calling * nice_agent_gather_candidates(): */ TRANSITION (DISCONNECTED, CONNECTING)); diff --git a/agent/discovery.c b/agent/discovery.c index cf79efb..1265f11 100644 --- a/agent/discovery.c +++ b/agent/discovery.c @@ -1022,10 +1022,12 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE || cand->type == NICE_CANDIDATE_TYPE_RELAYED)) { - agent_signal_component_state_change (agent, - cand->stream->id, - cand->component->id, - NICE_COMPONENT_STATE_GATHERING); + if (cand->component->state == NICE_COMPONENT_STATE_DISCONNECTED || + cand->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, -- 2.7.4