[Pkg-telepathy-commits] [libnice] 46/265: agent: Don't make relayed sockets available in nice_agent_get_selected_socket()

Simon McVittie smcv at debian.org
Wed May 14 12:04:51 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 42358ddec3e7d2044670b721dee3cf2f55b1096a
Author: Olivier Crête <olivier.crete at collabora.com>
Date:   Fri Jan 31 01:46:40 2014 -0500

    agent: Don't make relayed sockets available in nice_agent_get_selected_socket()
    
    Also document that fact.
---
 agent/agent.c | 13 +++++++++----
 agent/agent.h |  8 +++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index 3b0a35d..67c99fb 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2914,10 +2914,15 @@ nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id,
           &stream, &component))
     goto done;
 
-  if (component->selected_pair.local && component->selected_pair.remote) {
-    nice_socket = (NiceSocket *)component->selected_pair.local->sockptr;
-    g_socket = nice_socket->fileno;
-  }
+  if (!component->selected_pair.local || !component->selected_pair.remote)
+    goto done;
+
+  if (component->selected_pair.local->type == NICE_CANDIDATE_TYPE_RELAYED)
+    goto done;
+
+  nice_socket = (NiceSocket *)component->selected_pair.local->sockptr;
+  if (nice_socket->fileno)
+    g_socket = g_object_ref (nice_socket->fileno);
 
  done:
   agent_unlock();
diff --git a/agent/agent.h b/agent/agent.h
index 88281e7..c2a39d1 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -737,7 +737,13 @@ nice_agent_get_selected_pair (
  * it. New applications are encouraged to use the built in libnice stream
  * handling instead and let libnice handle the connection maintenance.
  *
- * Returns: pointer to the socket, or NULL if there is no selected candidate
+ * Users of this method are encouraged to not use a TURN relay or any kind
+ * of proxy, as in this case, the socket will not be available to the
+ * application because the packets are encapsulated.
+ *
+ * Returns: (transfer full) pointer to the #GSocket, or NULL if there is no
+ * selected candidate or if the selected candidate is a relayed candidate.
+ *
  * Since: 0.1.5
  */
 GSocket *

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