[Pkg-telepathy-commits] [libnice] 223/265: Protect test-dribble against read->connected->ready state changes

Simon McVittie smcv at debian.org
Wed May 14 12:05:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit f4a93f4fbd12fe57ce15708accc8534ae596f9fd
Author: Youness Alaoui <youness.alaoui at collabora.co.uk>
Date:   Wed Apr 16 18:50:10 2014 -0400

    Protect test-dribble against read->connected->ready state changes
---
 tests/test-dribble.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tests/test-dribble.c b/tests/test-dribble.c
index f750dbc..6603129 100644
--- a/tests/test-dribble.c
+++ b/tests/test-dribble.c
@@ -128,15 +128,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-dribble:%s: %p", G_STRFUNC, data);
 
-  if (GPOINTER_TO_UINT (data) == 1)
+  if (GPOINTER_TO_UINT (data) == 1) {
+    if (global_lagent_state == NICE_COMPONENT_STATE_READY &&
+        state == NICE_COMPONENT_STATE_CONNECTED)
+      ready_to_connected = TRUE;
     global_lagent_state = state;
-  else if (GPOINTER_TO_UINT (data) == 2)
+  } else if (GPOINTER_TO_UINT (data) == 2) {
+    if (global_ragent_state == NICE_COMPONENT_STATE_READY &&
+        state == NICE_COMPONENT_STATE_CONNECTED)
+      ready_to_connected = TRUE;
     global_ragent_state = 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++;
 
@@ -339,7 +349,7 @@ int main (void)
   g_timeout_add (500, quit_loop_cb, NULL);
   g_main_loop_run (global_mainloop);
 
-  global_components_ready--;
+  //global_components_ready--;
 
   cands = nice_agent_get_local_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTP);
   nice_address_set_port(&((NiceCandidate *) cands->data)->addr, 80);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list