[Nice] [nice/master] Use larger buffer so as not to truncate udp packets

Olivier Crete olivier.crete at collabora.co.uk
Wed Nov 5 14:01:05 PST 2008


darcs-hash:20080425230501-3e2dc-68e95654e1a3f299bd5b5ccb6f79215e22c42226.gz
---
 agent/agent.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index 5d5afc3..b9e99dc 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -68,6 +68,10 @@
 
 #include "stream.h"
 
+/* This is the max size of a UDP packet
+ * will it work tcp relaying??
+ */
+#define MAX_BUFFER_SIZE 65536
 
 G_DEFINE_TYPE (NiceAgent, nice_agent, G_TYPE_OBJECT);
 
@@ -1437,7 +1441,7 @@ nice_agent_poll_read (
             NiceUDPSocket *socket = NULL;
             Stream *stream = NULL;
 	    Component *component = NULL;
-            gchar buf[MAX_STUN_DATAGRAM_PAYLOAD];
+            gchar buf[MAX_BUFFER_SIZE];
             guint len;
 
             for (i = agent->streams; i; i = i->next)
@@ -1458,7 +1462,7 @@ nice_agent_poll_read (
               break;
 
             len = _nice_agent_recv (agent, stream, component,
-				    socket, MAX_STUN_DATAGRAM_PAYLOAD, buf);
+				    socket, MAX_BUFFER_SIZE, buf);
 
             if (len && func != NULL)
               func (agent, stream->id, component->id, len, buf,
@@ -1744,7 +1748,7 @@ nice_agent_g_source_cb (
   NiceAgent *agent = ctx->agent;
   Stream *stream = ctx->stream;
   Component *component = ctx->component;
-  gchar buf[MAX_STUN_DATAGRAM_PAYLOAD];
+  gchar buf[MAX_BUFFER_SIZE];
   guint len;
 
   g_mutex_lock (agent->mutex);
@@ -1753,7 +1757,7 @@ nice_agent_g_source_cb (
   (void)source;
 
   len = _nice_agent_recv (agent, stream, component, ctx->socket,
-			  MAX_STUN_DATAGRAM_PAYLOAD, buf);
+			  MAX_BUFFER_SIZE, buf);
 
   if (len > 0)
     ctx->recv_func (agent, stream->id, component->id,
-- 
1.5.6.5




More information about the Nice mailing list