mirror of
https://github.com/coturn/coturn.git
synced 2026-05-12 09:40:35 +00:00
3294c714aa
## Summary This change lets the listener batch incoming UDP datagrams when `--udp-recvmmsg` is enabled, reducing per-packet overhead on busy listeners while preserving the existing behavior as the default and fallback path. ## What changed - add a new `--udp-recvmmsg` runtime flag - implement a batched UDP receive path in the DTLS listener using `recvmmsg()` - reuse packet classification and datagram processing logic across batched and non-batched receive paths - reduce buffer/metadata churn by reusing listener-side scratch state and network buffers - keep compatibility safeguards by falling back when `recvmmsg()` is unavailable or unsupported - expose the setting in admin/CLI configuration output - update the example test runner to enable the flag on Linux ## Why The current listener processes UDP datagrams one at a time. On Linux, `recvmmsg()` allows the server to receive multiple packets per syscall, which should improve throughput and lower CPU overhead under load for UDP-heavy traffic. ## Notes - the feature is opt-in and defaults to disabled - the implementation is Linux-specific and leaves the existing path unchanged on other platforms - the listener still falls back to the legacy receive path if batched receive is unavailable at runtime ## Testing - updated `examples/run_tests.sh` to pass `--udp-recvmmsg` on Linux - validated behavior through the existing listener flow and fallback handling