[Pkg-telepathy-commits] [libnice] 95/265: agent: Correct maximum UDP data length

Simon McVittie smcv at debian.org
Wed May 14 12:04:56 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 d638586cab1e8b8f90aa2a8de353ae490ddd5f16
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date:   Tue Jan 21 09:51:29 2014 +0000

    agent: Correct maximum UDP data length
    
    The maximum number of bytes in a UDP packet (ignoring problems like
    fragmentation and MTUs) is 65535 = 2^16-1 bytes, as the length field
    in the packet header is 16b wide.
---
 agent/agent.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index be84128..f31816e 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -73,10 +73,10 @@
 
 #include "pseudotcp.h"
 
-/* This is the max size of a UDP packet
- * will it work tcp relaying??
- */
-#define MAX_BUFFER_SIZE 65536
+/* Maximum size of a UDP packet’s payload, as the packet’s length field is 16b
+ * wide. */
+#define MAX_BUFFER_SIZE ((1 << 16) - 1)  /* 65535 */
+
 #define DEFAULT_STUN_PORT  3478
 #define DEFAULT_UPNP_TIMEOUT 200
 
@@ -2664,7 +2664,7 @@ done:
  * In the non-error case, in reliable mode, this will block until exactly
  * @buf_len bytes have been received. In non-reliable mode, it will block until
  * a single message has been received. In this case, @buf must be big enough to
- * contain an entire message (65536 bytes), or any excess data may be silently
+ * contain an entire message (65535 bytes), or any excess data may be silently
  * dropped.
  *
  * This must not be used in combination with nice_agent_attach_recv() on the
@@ -2711,7 +2711,7 @@ nice_agent_recv (NiceAgent *agent, guint stream_id, guint component_id,
  *
  * For a reliable @agent, this function will receive as many bytes as possible
  * up to @buf_len. For a non-reliable @agent, it will receive a single message.
- * In this case, @buf must be big enough to contain the entire message (65536
+ * In this case, @buf must be big enough to contain the entire message (65535
  * bytes), or any excess data may be silently dropped.
  *
  * As this function is non-blocking, @cancellable is included only for parity

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