Tags: xtaci/smux
Tags
perf(stream): cache window update threshold to reduce computation Add windowUpdateThreshold field to stream struct to cache the MaxStreamBuffer/2 calculation. This avoids repeated pointer dereferences (s.sess.config.MaxStreamBuffer) and integer division on every tryReadV2() and writeToV2() call in the hot path. - Add windowUpdateThreshold uint32 field to stream struct - Initialize threshold in newStream() - Use cached value in tryReadV2() and writeToV2()
Squashed commit of the following: commit c8a401f Author: xtaci <imap@live.com> Date: Sat Jan 24 22:29:03 2026 +0800 fix(session): reject cmdUPD in protocol version 1 cmdUPD is a v2-only command used for flow control window updates. Previously, recvLoop would accept and process cmdUPD even when the session was configured for protocol version 1, which violates the protocol specification. This change adds a version check before processing cmdUPD. If the session is not running v2, it now correctly returns ErrInvalidProtocol and terminates the receive loop.
PreviousNext