1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-10 21:22:20 +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

@@ -84,6 +84,25 @@ void setupCommonExpects(MockQuicPacketBuilder& pktBuilder) {
pktBuilder.appender_.insert(std::move(buf));
})));
EXPECT_CALL(pktBuilder, _insert(_, _))
.WillRepeatedly(WithArgs<0, 1>(Invoke([&](Buf& buf, size_t limit) {
pktBuilder.remaining_ -= limit;
std::unique_ptr<folly::IOBuf> cloneBuf;
folly::io::Cursor cursor(buf.get());
cursor.clone(cloneBuf, limit);
pktBuilder.appender_.insert(std::move(cloneBuf));
})));
EXPECT_CALL(pktBuilder, insert(_, _))
.WillRepeatedly(
WithArgs<0, 1>(Invoke([&](const BufQueue& buf, size_t limit) {
pktBuilder.remaining_ -= limit;
std::unique_ptr<folly::IOBuf> cloneBuf;
folly::io::Cursor cursor(buf.front());
cursor.clone(cloneBuf, limit);
pktBuilder.appender_.insert(std::move(cloneBuf));
})));
EXPECT_CALL(pktBuilder, push(_, _))
.WillRepeatedly(
WithArgs<0, 1>(Invoke([&](const uint8_t* data, size_t len) {