aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-16 11:11:25 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-16 11:11:25 +0200
commit1557ba53d8a7110869484ac5f9ccf03c5cfea322 (patch)
treeb3178a6efe0effda68160b5ee2aaa83165877650 /packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py
parent625b2fea074e1c23b992b5759126595b6850af32 (diff)
parent595d316f18576356182d81923b28b861bbaec2cc (diff)
downloadmeshbay-1557ba53d8a7110869484ac5f9ccf03c5cfea322.tar.gz
Merge branch 'main' of meshbay.org:meshbay
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py')
-rw-r--r--packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py b/packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py
new file mode 100644
index 0000000..c0045d8
--- /dev/null
+++ b/packages/meshbay-cli/src/meshbay_cli/client/udp_buffer.py
@@ -0,0 +1,18 @@
+"""A larger receive buffer on the client's ICE sockets, applied on import.
+
+In a download the client is the receiver, and it reads its socket from Python
+— on the same event loop as the terminal interface — more slowly than a node
+sends in bursts. aioice asks the kernel for 256 KB per socket; what does not fit
+is dropped by this machine's kernel (`UdpRcvbufErrors`), the node's SCTP sender
+takes each drop for congestion and halves its window. Measured on loopback, 400
+MB: 3245 drops and 19 MB/s with 256 KB. The node does the same for the same
+reason in the other direction (`meshbay_node/transport/webrtc/udp_buffer.py`).
+
+Linux grants no more than `net.core.rmem_max`; Windows grants what is asked.
+"""
+
+import aioice.turn
+
+WANTED = 4 * 1024 * 1024
+
+aioice.turn.UDP_SOCKET_BUFFER_SIZE = WANTED