[Pkg-telepathy-commits] [libnice] 187/265: agent: Prevent gather from being called multiple times

Simon McVittie smcv at debian.org
Wed May 14 12:05:06 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 b2189b848dcdce40abbfad00700b2812d691dfda
Author: Olivier Crête <olivier.crete at collabora.com>
Date:   Thu Mar 27 21:09:15 2014 -0400

    agent: Prevent gather from being called multiple times
    
    This can cause odd behaviors as it is not a idempotent function.
---
 agent/agent.c  | 8 +++++++-
 agent/stream.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/agent/agent.c b/agent/agent.c
index 0f48fbc..fe32b27 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2123,6 +2123,12 @@ nice_agent_gather_candidates (
     return FALSE;
   }
 
+  if (stream->gathering_started) {
+    /* Stream is already gathering, ignore this call */
+    agent_unlock_and_emit (agent);
+    return TRUE;
+  }
+
   nice_debug ("Agent %p : In %s mode, starting candidate gathering.", agent,
       agent->full_mode ? "ICE-FULL" : "ICE-LITE");
 
@@ -2276,7 +2282,7 @@ nice_agent_gather_candidates (
   }
 
   stream->gathering = TRUE;
-
+  stream->gathering_started = TRUE;
 
   /* Only signal the new candidates after we're sure that the gathering was
    * succesfful. But before sending gathering-done */
diff --git a/agent/stream.h b/agent/stream.h
index 08c39c5..96a478b 100644
--- a/agent/stream.h
+++ b/agent/stream.h
@@ -72,6 +72,7 @@ struct _Stream
   gchar remote_ufrag[NICE_STREAM_MAX_UFRAG];
   gchar remote_password[NICE_STREAM_MAX_PWD];
   gboolean gathering;
+  gboolean gathering_started;
   gint tos;
 };
 

-- 
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