- Replaced inefficient vector-based buffer with a queue of discrete message buffers
- Moved common code to base class to reduce duplication
- Removed unnecessary data copying after partial sends
- Added small-buffer optimization to allow writing with backlog <256 bytes
- Moved common code to base class to reduce duplication
- Replaced inefficient vector-based buffer with a queue of discrete message buffers
- Moved common code to base class to reduce duplication
- Removed unnecessary data copying after partial sends
- Added small-buffer optimization to allow writing with backlog <256 bytes
- Moved common code to base class to reduce duplication
This PR optimizes memory usage in the APIPlaintextFrameHelper by replacing the vector-based header buffer with a fixed-size buffer, similar to what's already done in the noise protocol implementation.
- Replaced `std::vector<uint8_t> rx_header_buf_` with a 5-byte fixed buffer `uint8_t rx_header_buf_[5]`
- Implemented a modified protocol parsing algorithm that validates the indicator byte without storing it
- Ensured compatibility with noise protocol by supporting message sizes up to at least 65535 (requires 3-byte varint)
- Improved readability with clearer conditional logic and better comments
- Added detailed notes about protocol limitations and variable length encoding
- Reduces memory fragmentation by eliminating dynamic allocations during header parsing
This PR optimizes memory usage in the APIPlaintextFrameHelper by replacing the vector-based header buffer with a fixed-size buffer, similar to what's already done in the noise protocol implementation.
- Replaced `std::vector<uint8_t> rx_header_buf_` with a 5-byte fixed buffer `uint8_t rx_header_buf_[5]`
- Implemented a modified protocol parsing algorithm that validates the indicator byte without storing it
- Ensured compatibility with noise protocol by supporting message sizes up to at least 65535 (requires 3-byte varint)
- Improved readability with clearer conditional logic and better comments
- Added detailed notes about protocol limitations and variable length encoding
- Reduces memory fragmentation by eliminating dynamic allocations during header parsing