1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00

Move Quic Stream data writing from WriteCodec to PacketBuilder

Summary:
Different Builders now want to have its own way of writing or
appending write buffer. So let builders handle them.

This also add new APIs in BufWriter to copy data from IOBuf/BufQueue directly
into a destination IOBuf without cloning inbetween.

Reviewed By: mjoras

Differential Revision: D20821789

fbshipit-source-id: c0a24eb12378f64cf26c27d4232f610ed80fba84
This commit is contained in:
Yang Chi
2020-04-07 08:43:40 -07:00
committed by Facebook GitHub Bot
parent 826031a8f2
commit db58ba1ca4
9 changed files with 199 additions and 29 deletions

View File

@@ -140,10 +140,7 @@ void writeStreamFrameData(
const BufQueue& writeBuffer,
uint64_t dataLen) {
if (dataLen > 0) {
Buf streamData;
folly::io::Cursor cursor(writeBuffer.front());
cursor.clone(streamData, dataLen);
builder.insert(std::move(streamData));
builder.insert(writeBuffer, dataLen);
}
}
@@ -152,10 +149,7 @@ void writeStreamFrameData(
Buf writeBuffer,
uint64_t dataLen) {
if (dataLen > 0) {
Buf streamData;
folly::io::Cursor cursor(writeBuffer.get());
cursor.clone(streamData, dataLen);
builder.insert(std::move(streamData));
builder.insert(std::move(writeBuffer), dataLen);
}
}