mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-24 04:01:07 +03:00
BufQueue::trimAtMost
Summary: - trimAtMost() can be implemented via splitAtMost() - trimAtMost() now releases owned IOBuf if the entire chain is consumed Reviewed By: mjoras Differential Revision: D46776767 fbshipit-source-id: 0ace20d07d8b9adc1a5171e39732b8278776c332
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3787e35f24
commit
aff02e01ee
@@ -840,20 +840,22 @@ QuicFrame parseFrame(
|
||||
throw QuicTransportException(
|
||||
"Invalid frame-type field", TransportErrorCode::FRAME_ENCODING_ERROR);
|
||||
}
|
||||
queue.trimStart(cursor - queue.front());
|
||||
queue.trimStart(frameTypeInt->second);
|
||||
bool consumedQueue = false;
|
||||
bool error = false;
|
||||
SCOPE_EXIT {
|
||||
if (consumedQueue || error) {
|
||||
return;
|
||||
}
|
||||
queue.trimStart(cursor - queue.front());
|
||||
if (!queue.empty()) {
|
||||
queue.trimStart(cursor - queue.front());
|
||||
}
|
||||
};
|
||||
cursor.reset(queue.front());
|
||||
// trimStart() may have free'd the IOBuf;
|
||||
folly::IOBuf emptyBuf{};
|
||||
cursor.reset(queue.empty() ? &emptyBuf : queue.front());
|
||||
FrameType frameType = static_cast<FrameType>(frameTypeInt->first);
|
||||
try
|
||||
|
||||
{
|
||||
try {
|
||||
switch (frameType) {
|
||||
case FrameType::PADDING:
|
||||
return QuicFrame(decodePaddingFrame(cursor));
|
||||
|
||||
Reference in New Issue
Block a user