Zero-copy encode: pack response body in place, single shared tx_buf, drain rx loop

This commit is contained in:
Ian Gulliver
2026-04-10 22:48:28 +09:00
parent 58db392bf3
commit 8408603390
8 changed files with 98 additions and 57 deletions

View File

@@ -236,6 +236,12 @@ public:
return *this;
}
pack_result pack_uint32_fixed(uint32_t n) {
m_buf.push_back(format::UINT32);
push_big_endian(n);
return *this;
}
pack_result pack_float(float n) {
m_buf.push_back(format::FLOAT32);
push_big_endian(n);
@@ -322,6 +328,19 @@ public:
return *this;
}
pack_result pack_ext16_header(char type, uint16_t len) {
m_buf.push_back(format::EXT16);
push_big_endian(len);
m_buf.push_back(static_cast<uint8_t>(type));
return *this;
}
pack_result pack_bin16_header(uint16_t len) {
m_buf.push_back(format::BIN16);
push_big_endian(len);
return *this;
}
template <class Range>
pack_result pack_ext(char type, const Range &r) {
auto sz = static_cast<size_t>(std::distance(std::begin(r), std::end(r)));