diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2014-04-08 23:55:00 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2014-05-15 09:44:00 -0400 |
commit | 7048b757ab7a37c296a9652daffc8cace8b181bb (patch) | |
tree | 95a487e1344778dd54a2151c47c6721733633eb9 /tests | |
parent | 425f534abe2991f0c2285aab2f9c912da637b4d7 (diff) | |
download | libnice-7048b757ab7a37c296a9652daffc8cace8b181bb.tar.gz |
test-fullmode: protect against ready->connected->ready state change and accept data reception on connected state
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-fullmode.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/test-fullmode.c b/tests/test-fullmode.c index 3422ecc..fe66a57 100644 --- a/tests/test-fullmode.c +++ b/tests/test-fullmode.c @@ -210,15 +210,25 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint component_id, guint state, gpointer data) { + gboolean ready_to_connected = FALSE; g_debug ("test-fullmode:%s: %p", G_STRFUNC, data); - if (GPOINTER_TO_UINT (data) == 1) + if (GPOINTER_TO_UINT (data) == 1) { + if (global_lagent_state[component_id - 1] == NICE_COMPONENT_STATE_READY && + state == NICE_COMPONENT_STATE_CONNECTED) + ready_to_connected = TRUE; global_lagent_state[component_id - 1] = state; - else if (GPOINTER_TO_UINT (data) == 2) + } else if (GPOINTER_TO_UINT (data) == 2) { + if (global_ragent_state[component_id - 1] == NICE_COMPONENT_STATE_READY && + state == NICE_COMPONENT_STATE_CONNECTED) + ready_to_connected = TRUE; global_ragent_state[component_id - 1] = state; - + } + if (state == NICE_COMPONENT_STATE_READY) global_components_ready++; + else if (state == NICE_COMPONENT_STATE_CONNECTED && ready_to_connected) + global_components_ready--; if (state == NICE_COMPONENT_STATE_FAILED) global_components_failed++; @@ -1031,10 +1041,14 @@ int main (void) priv_print_global_status (); /* should SUCCEED as agent L can send the checks: */ g_assert (result == 0); - g_assert (global_lagent_state[0] == NICE_COMPONENT_STATE_READY); - g_assert (global_lagent_state[1] == NICE_COMPONENT_STATE_READY); - g_assert (global_ragent_state[0] == NICE_COMPONENT_STATE_READY); - g_assert (global_ragent_state[1] == NICE_COMPONENT_STATE_READY); + g_assert (global_lagent_state[0] == NICE_COMPONENT_STATE_CONNECTED || + global_lagent_state[0] == NICE_COMPONENT_STATE_READY); + g_assert (global_lagent_state[1] == NICE_COMPONENT_STATE_CONNECTED || + global_lagent_state[1] == NICE_COMPONENT_STATE_READY); + g_assert (global_ragent_state[0] == NICE_COMPONENT_STATE_CONNECTED || + global_ragent_state[0] == NICE_COMPONENT_STATE_READY); + g_assert (global_ragent_state[1] == NICE_COMPONENT_STATE_CONNECTED || + global_ragent_state[1] == NICE_COMPONENT_STATE_READY); g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 100, NULL); /* run test with a conflict in controlling mode: controlling-controlling */ |