Commit d638586c authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête
Browse files

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.
parent b222b1bf
...@@ -73,10 +73,10 @@ ...@@ -73,10 +73,10 @@
#include "pseudotcp.h" #include "pseudotcp.h"
/* This is the max size of a UDP packet /* Maximum size of a UDP packet’s payload, as the packet’s length field is 16b
* will it work tcp relaying?? * wide. */
*/ #define MAX_BUFFER_SIZE ((1 << 16) - 1) /* 65535 */
#define MAX_BUFFER_SIZE 65536
#define DEFAULT_STUN_PORT 3478 #define DEFAULT_STUN_PORT 3478
#define DEFAULT_UPNP_TIMEOUT 200 #define DEFAULT_UPNP_TIMEOUT 200
...@@ -2664,7 +2664,7 @@ done: ...@@ -2664,7 +2664,7 @@ done:
* In the non-error case, in reliable mode, this will block until exactly * 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 * @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 * 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. * dropped.
* *
* This must not be used in combination with nice_agent_attach_recv() on the * 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, ...@@ -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 * 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. * 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. * bytes), or any excess data may be silently dropped.
* *
* As this function is non-blocking, @cancellable is included only for parity * As this function is non-blocking, @cancellable is included only for parity
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment