How BibaVPN Handles Flow Control and Receive Buffers in a Rust TCP Multiplexer

BibaVPN, an experimental Rust-based tunnel, implements a TCP multiplexer that carries multiple logical streams over a shared WebSocket connection. The system uses per-stream receive state and separate directional pumps to prevent any single stream's socket speed from blocking others. A negotiated byte-credit extension tracks outstanding data, only returning flow-control credit to a peer after a write_all() call completes to avoid buffer overruns. A session-level 64 MiB admission budget caps how many streams can reserve local receive windows simultaneously. The implementation also accounts for bytes::Bytes backing-allocation behavior, which can cause a short slice to retain a much larger underlying memory block if not explicitly compacted.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in