Skip to main content

UDP_BUFFER_SIZE

Constant UDP_BUFFER_SIZE 

Source
pub const UDP_BUFFER_SIZE: usize = 1500;
Expand description

Maximum size, in bytes, of UDP payloads for client / server send paths that serialize into a fixed-size buffer of this size.

Paths currently capped by this constant:

  • client::SocketManager::send (unicast + SD outbound)
  • server::EventPublisher::publish_event
  • server::EventPublisher::publish_raw_event

When one of these paths is actually reached and serialization is attempted, messages larger than this cap fail with client::Error::Capacity("udp_buffer") or server::Error::Capacity("udp_buffer"), depending on the path. Paths that return early before attempting serialization (e.g. publish_event when there are no subscribers) are not affected. The remaining outbound SD paths (OfferService announcements, SubscribeAck / SubscribeNack) serialize into stack buffers of this same size — the phase-21 per-event-allocation cleanup (7c58649) removed the former heap Vec buffers, so every outbound path is capped by this constant.

Note that this is an application-level UDP payload limit, not an Ethernet-MTU-safe size: a 1500-byte UDP payload exceeds a 1500-byte L2 MTU once IP/UDP headers are added (IPv4 leaves 1472 bytes of UDP payload, IPv6 leaves 1452), so sends at this size may fragment or fail depending on the network stack. Bare-metal ports targeting a smaller link MTU may want to lower this by forking.