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