Commit 1a234765 authored by Jakub Adam's avatar Jakub Adam Committed by Olivier Crête

test-icetcp: don't be sensitive to the signal order

"new-selected-pair" may be emitted after "component-state-changed"
to READY, by which time the main loop might have gotten quit in
cb_component_state_changed(). Consequently, cb_new_selected_pair() could
miss to register the selected pair, ultimately leading to an assertion
failure in main().

We should wait for both selected pair and state change events to occur
before stopping the main loop.

Differential Revision:
parent b5593847
......@@ -125,6 +125,14 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin
static void check_loop_quit_condition (void)
if (global_ready_reached &&
global_lagent_cands >= 2 && global_ragent_cands >= 2) {
g_main_loop_quit (global_mainloop);
static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint component_id, guint state, gpointer data)
gboolean ready_to_connected = FALSE;
......@@ -158,10 +166,10 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
global_ready_reached == FALSE) {
g_debug ("Components ready/failed achieved. Stopping mailoop");
global_ready_reached = TRUE;
g_main_loop_quit (global_mainloop);
check_loop_quit_condition ();
#if 0
/* signal status via a global variable */
if (global_components_failed == global_components_failed_exit) {
......@@ -184,6 +192,8 @@ static void cb_new_selected_pair(NiceAgent *agent, guint stream_id, guint compon
else if (GPOINTER_TO_UINT (data) == 2)
check_loop_quit_condition ();
/* XXX: dear compiler, these are for you: */
(void)agent; (void)stream_id; (void)component_id; (void)lfoundation; (void)rfoundation;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment