summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2016-06-14 21:12:16 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-06-21 16:05:57 -0400
commit59fe48517c0b7db77b99183d31fdd84b55adb5d4 (patch)
treedb1be93a4a1d14a2c7d0bf12b888e65390e5841e
parent6a512b6eca9603ce8bf3ed0814fd314684c66ea7 (diff)
downloadlibnice-59fe48517c0b7db77b99183d31fdd84b55adb5d4.tar.gz
conncheck: fix a state transition case
When a new stun request hits a valid pair, of a failed component, we may have a transition from state failed to connected. In this situation, we do a logical progression failed -> connecting -> connected, like we do in function priv_update_check_list_state_for_ready() Similarily, when a new stun request hits a failed pair, of a failed component, triggering a new conncheck for this pair may also cause the component state to move back from failed to connecting state. Differential Revision: https://phabricator.freedesktop.org/D1118
-rw-r--r--agent/conncheck.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index d31b77f..e1a5cf1 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1973,12 +1973,14 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
pair->nominated = TRUE;
priv_update_selected_pair (agent, component, pair);
/* Do not step down to CONNECTED if we're already at state READY*/
- if (component->state != NICE_COMPONENT_STATE_READY) {
+ if (component->state == NICE_COMPONENT_STATE_FAILED)
+ agent_signal_component_state_change (agent,
+ stream->id, component->id, NICE_COMPONENT_STATE_CONNECTING);
+ if (component->state == NICE_COMPONENT_STATE_CONNECTING)
/* step: notify the client of a new component state (must be done
* before the possible check list state update step */
agent_signal_component_state_change (agent,
stream->id, component->id, NICE_COMPONENT_STATE_CONNECTED);
- }
priv_update_check_list_state_for_ready (agent, stream, component);
} else if (pair->state == NICE_CHECK_IN_PROGRESS) {
pair->mark_nominated_on_response_arrival = TRUE;
@@ -2004,13 +2006,14 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
if (pair->valid) {
priv_update_selected_pair (agent, component, pair);
/* Do not step down to CONNECTED if we're already at state READY*/
- if (component->state != NICE_COMPONENT_STATE_READY) {
+ if (component->state == NICE_COMPONENT_STATE_FAILED)
+ agent_signal_component_state_change (agent,
+ stream->id, component->id, NICE_COMPONENT_STATE_CONNECTING);
+ if (component->state == NICE_COMPONENT_STATE_CONNECTING)
/* step: notify the client of a new component state (must be done
* before the possible check list state update step */
agent_signal_component_state_change (agent,
stream->id, component->id, NICE_COMPONENT_STATE_CONNECTED);
- }
-
}
priv_update_check_list_state_for_ready (agent, stream, component);
}
@@ -2854,6 +2857,14 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
pair (representing a new STUN Binding request transaction), by
enqueueing the pair in the triggered check queue. */
priv_add_pair_to_triggered_check_queue (agent, p);
+ /* If the component for this pair is in failed state, move it
+ * back to connecting, and reinitiate the timers
+ */
+ if (component->state == NICE_COMPONENT_STATE_FAILED) {
+ agent_signal_component_state_change (agent, stream->id,
+ component->id, NICE_COMPONENT_STATE_CONNECTING);
+ conn_check_schedule_next (agent);
+ }
}
/* note: the spec says the we SHOULD retransmit in-progress