| 183 | } |
| 184 | |
| 185 | void send(ITransport& transport) const { |
| 186 | std::size_t total = 0; |
| 187 | for (const auto& block : message_blocks_) { |
| 188 | total += block->size(); |
| 189 | } |
| 190 | std::vector<std::byte> frame; |
| 191 | frame.reserve(total); |
| 192 | for (const auto& block : message_blocks_) { |
| 193 | const auto* data = block->data(); |
| 194 | frame.insert(frame.end(), data, data + block->size()); |
| 195 | } |
| 196 | if (!frame.empty()) { |
| 197 | transport.send(frame); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | void clear() { |
| 202 | message_blocks_.clear(); |