Zero-copy encode: pack response body in place, single shared tx_buf, drain rx loop
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user