Zero-copy decode: span-based Envelope and DecodedMessage, defer usb_rx_buf clear
This commit is contained in:
@@ -59,12 +59,11 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
||||
continue;
|
||||
}
|
||||
|
||||
usb_rx_buf.clear();
|
||||
|
||||
auto it = handler_map.find(msg->type_id);
|
||||
if (it == handler_map.end()) continue;
|
||||
if (it == handler_map.end()) { usb_rx_buf.clear(); continue; }
|
||||
span_writer out(tx_buf);
|
||||
auto resp = it->second(msg->message_id, msg->payload, out);
|
||||
usb_rx_buf.clear();
|
||||
if (!resp || *resp == 0) continue;
|
||||
size_t resp_len = *resp;
|
||||
if (resp_len <= usb.tx.free()) {
|
||||
|
||||
Reference in New Issue
Block a user