mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-12-24 09:40:59 +03:00
Use appendToChain instead of deprecated name prependChain
Summary: See title Differential Revision: D74206613 fbshipit-source-id: b8acaaabe3de34f5e5af03e91455ccb342939c86
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a56be059b9
commit
469da60216
@@ -51,7 +51,7 @@ bool GSOPacketBatchWriter::append(
|
||||
|
||||
// now we've got an additional buffer
|
||||
// append it to the chain
|
||||
buf_->prependChain(std::move(buf));
|
||||
buf_->appendToChain(std::move(buf));
|
||||
currBufs_++;
|
||||
|
||||
// see if we've added a different size
|
||||
@@ -252,7 +252,7 @@ bool SendmmsgGSOPacketBatchWriter::append(
|
||||
// we can append
|
||||
options_[idx].gso = prevSize_[idx];
|
||||
prevSize_[idx] = size;
|
||||
bufs_[idx]->prependChain(std::move(buf));
|
||||
bufs_[idx]->appendToChain(std::move(buf));
|
||||
currBufs_++;
|
||||
|
||||
// flush if we reach maxBufs_
|
||||
|
||||
@@ -1441,7 +1441,7 @@ void writeCloseCommon(
|
||||
bufUniquePtr->length(),
|
||||
headerCipher);
|
||||
folly::IOBuf packetBuf(std::move(packet.header));
|
||||
packetBuf.prependChain(std::move(bufUniquePtr));
|
||||
packetBuf.appendToChain(std::move(bufUniquePtr));
|
||||
auto packetSize = packetBuf.computeChainDataLength();
|
||||
if (connection.qLogger) {
|
||||
connection.qLogger->addPacket(packet.packet, packetSize);
|
||||
|
||||
@@ -3285,7 +3285,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldData) {
|
||||
EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _))
|
||||
.WillRepeatedly(Invoke([&](auto& buf, auto, auto) {
|
||||
if (buf) {
|
||||
pktBodyCaptured.prependChain(buf->clone());
|
||||
pktBodyCaptured.appendToChain(buf->clone());
|
||||
return buf->clone();
|
||||
} else {
|
||||
return folly::IOBuf::create(0);
|
||||
@@ -3299,7 +3299,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldData) {
|
||||
EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _))
|
||||
.WillRepeatedly(Invoke([&](auto& buf, auto, auto) {
|
||||
if (buf) {
|
||||
secondBodyCaptured.prependChain(buf->clone());
|
||||
secondBodyCaptured.appendToChain(buf->clone());
|
||||
return buf->clone();
|
||||
} else {
|
||||
return folly::IOBuf::create(0);
|
||||
@@ -3332,7 +3332,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldDataAckFreq) {
|
||||
EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _))
|
||||
.WillRepeatedly(Invoke([&](auto& buf, auto, auto) {
|
||||
if (buf) {
|
||||
pktBodyCaptured.prependChain(buf->clone());
|
||||
pktBodyCaptured.appendToChain(buf->clone());
|
||||
return buf->clone();
|
||||
} else {
|
||||
return folly::IOBuf::create(0);
|
||||
@@ -3352,7 +3352,7 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingOldDataAckFreq) {
|
||||
EXPECT_CALL(*capturingAead, _inplaceEncrypt(_, _, _))
|
||||
.WillRepeatedly(Invoke([&](auto& buf, auto, auto) {
|
||||
if (buf) {
|
||||
secondBodyCaptured.prependChain(buf->clone());
|
||||
secondBodyCaptured.appendToChain(buf->clone());
|
||||
return buf->clone();
|
||||
} else {
|
||||
return folly::IOBuf::create(0);
|
||||
|
||||
@@ -1073,7 +1073,7 @@ TYPED_TEST(
|
||||
this->getTransport()->writeChain(streamId, data2->clone(), false);
|
||||
const auto maybeWrittenPackets2 = this->loopForWrites();
|
||||
|
||||
data1->prependChain(std::move(data2));
|
||||
data1->appendToChain(std::move(data2));
|
||||
auto combined = std::move(data1);
|
||||
|
||||
// should have sent two packets
|
||||
|
||||
@@ -31,7 +31,7 @@ BufPtr packetToBuf(
|
||||
// This does not matter.
|
||||
PacketNum num = 10;
|
||||
if (!packet.header.empty()) {
|
||||
buf->prependChain(packet.header.clone());
|
||||
buf->appendToChain(packet.header.clone());
|
||||
}
|
||||
std::unique_ptr<folly::IOBuf> body = folly::IOBuf::create(0);
|
||||
if (!packet.body.empty()) {
|
||||
@@ -43,7 +43,7 @@ BufPtr packetToBuf(
|
||||
EXPECT_GT(body->computeChainDataLength(), bodySize);
|
||||
}
|
||||
if (body) {
|
||||
buf->prependChain(std::move(body));
|
||||
buf->appendToChain(std::move(body));
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ TEST_P(QuicPacketBuilderTest, EnforcePacketSizeWithCipherOverhead) {
|
||||
auto overhead = folly::IOBuf::create(1000);
|
||||
overhead->append(cipherOverhead);
|
||||
auto clone = buf->clone();
|
||||
clone->prependChain(std::move(overhead));
|
||||
clone->appendToChain(std::move(overhead));
|
||||
return std::move(clone);
|
||||
}));
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ void BufQueue::appendToChain(BufPtr& dst, BufPtr&& src) {
|
||||
if (dst == nullptr) {
|
||||
dst = std::move(src);
|
||||
} else {
|
||||
dst->prependChain(std::move(src));
|
||||
dst->appendToChain(std::move(src));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void BufAppender::push(const uint8_t* data, size_t len) {
|
||||
if (crtBuf_->tailroom() < len || lastBufShared_) {
|
||||
auto newBuf = BufHelpers::createCombined(std::max(appendLen_, len));
|
||||
Buf* newBufPtr = newBuf.get();
|
||||
head_->prependChain(std::move(newBuf));
|
||||
head_->appendToChain(std::move(newBuf));
|
||||
crtBuf_ = newBufPtr;
|
||||
}
|
||||
memcpy(crtBuf_->writableTail(), data, len);
|
||||
@@ -155,7 +155,7 @@ void BufAppender::insert(BufPtr data) {
|
||||
// If the buffer is shared we do not want to overrwrite the tail of the
|
||||
// buffer.
|
||||
lastBufShared_ = data->isShared();
|
||||
head_->prependChain(std::move(data));
|
||||
head_->appendToChain(std::move(data));
|
||||
crtBuf_ = dataPtr;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ struct NetworkData {
|
||||
BufPtr buf;
|
||||
for (auto& packet : packets_) {
|
||||
if (buf) {
|
||||
buf->prependChain(packet.buf.move());
|
||||
buf->appendToChain(packet.buf.move());
|
||||
} else {
|
||||
buf = packet.buf.move();
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ chunkIOBuf(std::unique_ptr<IOBuf> input, size_t chunks, BufCreator creator) {
|
||||
if (!chunked) {
|
||||
chunked = std::move(buf);
|
||||
} else {
|
||||
chunked->prependChain(std::move(buf));
|
||||
chunked->appendToChain(std::move(buf));
|
||||
}
|
||||
}
|
||||
|
||||
size_t remainLen = inputLen - (chunks - 1) * chunkLen;
|
||||
auto remain = creator(remainLen, chunks - 1);
|
||||
remain->append(remainLen);
|
||||
chunked->prependChain(std::move(remain));
|
||||
chunked->appendToChain(std::move(remain));
|
||||
|
||||
transformBuffer(
|
||||
*input, *chunked, [](uint8_t* out, const uint8_t* in, size_t len) {
|
||||
|
||||
@@ -33,7 +33,7 @@ TEST(BufAccessor, CapacityMatch) {
|
||||
TEST(BufAccessor, RefuseChainedBuf) {
|
||||
BufAccessor accessor(1000);
|
||||
auto buf = accessor.obtain();
|
||||
buf->prependChain(folly::IOBuf::create(0));
|
||||
buf->appendToChain(folly::IOBuf::create(0));
|
||||
EXPECT_DEATH(accessor.release(std::move(buf)), "");
|
||||
}
|
||||
} // namespace quic
|
||||
|
||||
@@ -427,9 +427,9 @@ TEST(BufWriterTest, InsertChain) {
|
||||
BufWriter writer(testBuffer->writableTail(), 1000);
|
||||
auto inputBuffer =
|
||||
folly::IOBuf::copyBuffer("Cause I lost you and now what am i to do?");
|
||||
inputBuffer->prependChain(
|
||||
inputBuffer->appendToChain(
|
||||
folly::IOBuf::copyBuffer(" Can't believe that we are through."));
|
||||
inputBuffer->prependChain(
|
||||
inputBuffer->appendToChain(
|
||||
folly::IOBuf::copyBuffer(" While the memory of you linger like a song."));
|
||||
auto len = inputBuffer->computeChainDataLength();
|
||||
writer.insert(inputBuffer.get());
|
||||
@@ -598,9 +598,9 @@ TEST(BufWriterTest, InsertChainByteChainedRange) {
|
||||
BufWriter writer(testBuffer->writableTail(), 1000);
|
||||
auto inputBuffer =
|
||||
folly::IOBuf::copyBuffer("Cause I lost you and now what am i to do?");
|
||||
inputBuffer->prependChain(
|
||||
inputBuffer->appendToChain(
|
||||
folly::IOBuf::copyBuffer(" Can't believe that we are through."));
|
||||
inputBuffer->prependChain(
|
||||
inputBuffer->appendToChain(
|
||||
folly::IOBuf::copyBuffer(" While the memory of you linger like a song."));
|
||||
auto len = inputBuffer->computeChainDataLength();
|
||||
ChainedByteRangeHead cbrh(inputBuffer);
|
||||
|
||||
@@ -406,7 +406,7 @@ RegularQuicPacketBuilder::Packet createCryptoPacket(
|
||||
BufPtr packetToBuf(const RegularQuicPacketBuilder::Packet& packet) {
|
||||
auto packetBuf = packet.header.clone();
|
||||
if (!packet.body.empty()) {
|
||||
packetBuf->prependChain(packet.body.clone());
|
||||
packetBuf->appendToChain(packet.body.clone());
|
||||
}
|
||||
return packetBuf;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ BufPtr packetToBufCleartext(
|
||||
packet.header.coalesce();
|
||||
auto tagLen = cleartextCipher.getCipherOverhead();
|
||||
if (body->tailroom() < tagLen) {
|
||||
body->prependChain(folly::IOBuf::create(tagLen));
|
||||
body->appendToChain(folly::IOBuf::create(tagLen));
|
||||
}
|
||||
body->coalesce();
|
||||
auto encryptedBody = cleartextCipher.inplaceEncrypt(
|
||||
@@ -449,7 +449,7 @@ BufPtr packetToBufCleartext(
|
||||
encryptedBody->data(),
|
||||
encryptedBody->length(),
|
||||
headerCipher);
|
||||
packetBuf->prependChain(std::move(encryptedBody));
|
||||
packetBuf->appendToChain(std::move(encryptedBody));
|
||||
return packetBuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,13 +216,13 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
|
||||
BufPtr getHandshakeWriteBytes() {
|
||||
auto buf = folly::IOBuf::create(0);
|
||||
if (!cryptoState->initialStream.writeBuffer.empty()) {
|
||||
buf->prependChain(cryptoState->initialStream.writeBuffer.move());
|
||||
buf->appendToChain(cryptoState->initialStream.writeBuffer.move());
|
||||
}
|
||||
if (!cryptoState->handshakeStream.writeBuffer.empty()) {
|
||||
buf->prependChain(cryptoState->handshakeStream.writeBuffer.move());
|
||||
buf->appendToChain(cryptoState->handshakeStream.writeBuffer.move());
|
||||
}
|
||||
if (!cryptoState->oneRttStream.writeBuffer.empty()) {
|
||||
buf->prependChain(cryptoState->oneRttStream.writeBuffer.move());
|
||||
buf->appendToChain(cryptoState->oneRttStream.writeBuffer.move());
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ TEST_P(QuicClientTransportIntegrationTest, NetworkTest) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ TEST_P(QuicClientTransportIntegrationTest, FlowControlLimitedTest) {
|
||||
memset(data->writableData(), 'a', data->length());
|
||||
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ TEST_P(QuicClientTransportIntegrationTest, NetworkTestConnected) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ TEST_P(QuicClientTransportIntegrationTest, SetTransportSettingsAfterStart) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
settings.connectUDP = false;
|
||||
client->setTransportSettings(settings);
|
||||
@@ -524,7 +524,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttSuccess) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
EXPECT_CALL(clientConnSetupCallback, onReplaySafe());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
EXPECT_FALSE(client->getConn().zeroRttWriteCipher);
|
||||
@@ -602,7 +602,7 @@ TEST_P(QuicClientTransportIntegrationTest, ZeroRttRetryPacketTest) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
|
||||
EXPECT_CALL(clientConnSetupCallback, onReplaySafe()).WillOnce(Invoke([&] {
|
||||
EXPECT_TRUE(!client->getConn().retryToken.empty());
|
||||
@@ -635,7 +635,7 @@ TEST_P(QuicClientTransportIntegrationTest, NewTokenReceived) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
|
||||
EXPECT_FALSE(newToken->empty());
|
||||
@@ -657,7 +657,7 @@ TEST_P(QuicClientTransportIntegrationTest, UseNewTokenThenReceiveRetryToken) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
|
||||
EXPECT_FALSE(newToken->empty());
|
||||
@@ -744,7 +744,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttRejection) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
// Rejection means that we will unset the zero rtt cipher.
|
||||
EXPECT_EQ(client->getConn().zeroRttWriteCipher, nullptr);
|
||||
@@ -791,7 +791,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttNotAttempted) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
EXPECT_TRUE(client->serverInitialParamsSet());
|
||||
EXPECT_EQ(
|
||||
@@ -834,7 +834,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestZeroRttInvalidAppParams) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
EXPECT_TRUE(client->serverInitialParamsSet());
|
||||
EXPECT_EQ(
|
||||
@@ -868,7 +868,7 @@ TEST_P(QuicClientTransportIntegrationTest, ChangeEventBase) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
EXPECT_TRUE(client->isDetachable());
|
||||
client->detachEventBase();
|
||||
@@ -908,7 +908,7 @@ TEST_P(QuicClientTransportIntegrationTest, ResetClient) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
|
||||
// change the address to a new server which does not have the connection.
|
||||
@@ -953,7 +953,7 @@ TEST_P(QuicClientTransportIntegrationTest, TestStatelessResetToken) {
|
||||
auto streamId = client->createBidirectionalStream().value();
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
auto expected = std::shared_ptr<IOBuf>(IOBuf::copyBuffer("echo "));
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
sendRequestAndResponseAndWait(*expected, data->clone(), streamId, &readCb);
|
||||
|
||||
// change the address to a new server which does not have the connection.
|
||||
@@ -2554,7 +2554,7 @@ TEST_F(QuicClientTransportAfterStartTest, ReadStreamMultiplePackets) {
|
||||
auto data = IOBuf::copyBuffer("hello");
|
||||
|
||||
auto expected = data->clone();
|
||||
expected->prependChain(data->clone());
|
||||
expected->appendToChain(data->clone());
|
||||
EXPECT_CALL(readCb, readAvailable(streamId)).WillOnce(Invoke([&](auto) {
|
||||
auto readData = client->read(streamId, 1000);
|
||||
auto copy = readData->first->clone();
|
||||
@@ -5770,7 +5770,7 @@ TEST_F(QuicProcessDataTest, ProcessDataWithGarbageAtEnd) {
|
||||
0 /* largestAcked */);
|
||||
auto packetData = packetToBufCleartext(
|
||||
packet, aead, getInitialHeaderCipher(), nextPacketNum);
|
||||
packetData->prependChain(IOBuf::copyBuffer("garbage in"));
|
||||
packetData->appendToChain(IOBuf::copyBuffer("garbage in"));
|
||||
deliverData(serverAddr, packetData->coalesce());
|
||||
verifyTransportParameters(
|
||||
kDefaultConnectionFlowControlWindow,
|
||||
@@ -5894,7 +5894,7 @@ TEST_F(QuicProcessDataTest, ProcessPendingData) {
|
||||
mockClientHandshake->readBuffers[EncryptionLevel::Handshake].empty());
|
||||
auto handshakeReadData =
|
||||
mockClientHandshake->readBuffers[EncryptionLevel::Handshake].move();
|
||||
cryptoData->prependChain(cryptoData->clone());
|
||||
cryptoData->appendToChain(cryptoData->clone());
|
||||
EXPECT_TRUE(folly::IOBufEqualTo()(*cryptoData, *handshakeReadData));
|
||||
}
|
||||
|
||||
|
||||
@@ -642,7 +642,7 @@ TEST_F(QuicLossFunctionsTest, TestMarkPacketLossMerge) {
|
||||
EXPECT_EQ(stream1->streamLossCount, 2);
|
||||
|
||||
auto combined = buf1->clone();
|
||||
combined->prependChain(buf2->clone());
|
||||
combined->appendToChain(buf2->clone());
|
||||
auto& buffer = stream1->lossBuffer.front();
|
||||
EXPECT_EQ(buffer.offset, 0);
|
||||
EXPECT_TRUE(areEqual(combined.get(), &buffer.data));
|
||||
|
||||
@@ -213,7 +213,7 @@ class EchoHandler : public quic::QuicSocket::ConnectionSetupCallback,
|
||||
return;
|
||||
}
|
||||
auto echoedData = BufHelpers::copyBuffer("echo ");
|
||||
echoedData->prependChain(data.first.move());
|
||||
echoedData->appendToChain(data.first.move());
|
||||
auto res = sock->writeChain(id, std::move(echoedData), true, nullptr);
|
||||
if (res.hasError()) {
|
||||
LOG(ERROR) << "write error=" << toString(res.error());
|
||||
@@ -227,7 +227,7 @@ class EchoHandler : public quic::QuicSocket::ConnectionSetupCallback,
|
||||
CHECK_GT(datagrams.size(), 0);
|
||||
for (const auto& datagram : datagrams) {
|
||||
auto echoedData = BufHelpers::copyBuffer("echo ");
|
||||
echoedData->prependChain(datagram.bufQueue().front()->cloneCoalesced());
|
||||
echoedData->appendToChain(datagram.bufQueue().front()->cloneCoalesced());
|
||||
auto res = sock->writeDatagram(std::move(echoedData));
|
||||
if (res.hasError()) {
|
||||
LOG(ERROR) << "writeDatagram error=" << toString(res.error());
|
||||
|
||||
@@ -148,7 +148,7 @@ void TakeoverPacketHandler::forwardPacketToAnotherServer(
|
||||
bufWriter.writeBE<uint64_t>(tick);
|
||||
writeBuffer->append(bufSize);
|
||||
|
||||
writeBuffer->prependChain(std::move(buf));
|
||||
writeBuffer->appendToChain(std::move(buf));
|
||||
forwardPacket(std::move(writeBuffer));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ StatelessResetToken StatelessResetGenerator::generateToken(
|
||||
const ConnectionId& connId) const {
|
||||
StatelessResetToken token;
|
||||
auto info = toData(connId);
|
||||
info.prependChain(
|
||||
info.appendToChain(
|
||||
BufHelpers::wrapBuffer(addressStr_.data(), addressStr_.size()));
|
||||
auto out = hkdf_.expand(folly::range(extractedSecret_), info, token.size());
|
||||
out->coalesce();
|
||||
|
||||
@@ -287,18 +287,18 @@ class ServerHandshakeTest : public Test {
|
||||
switch (clientState.readRecordLayer()->getEncryptionLevel()) {
|
||||
case fizz::EncryptionLevel::Plaintext:
|
||||
if (!cryptoState->initialStream.writeBuffer.empty()) {
|
||||
buf->prependChain(cryptoState->initialStream.writeBuffer.move());
|
||||
buf->appendToChain(cryptoState->initialStream.writeBuffer.move());
|
||||
}
|
||||
break;
|
||||
case fizz::EncryptionLevel::Handshake:
|
||||
case fizz::EncryptionLevel::EarlyData:
|
||||
if (!cryptoState->handshakeStream.writeBuffer.empty()) {
|
||||
buf->prependChain(cryptoState->handshakeStream.writeBuffer.move());
|
||||
buf->appendToChain(cryptoState->handshakeStream.writeBuffer.move());
|
||||
}
|
||||
break;
|
||||
case fizz::EncryptionLevel::AppTraffic:
|
||||
if (!cryptoState->oneRttStream.writeBuffer.empty()) {
|
||||
buf->prependChain(cryptoState->oneRttStream.writeBuffer.move());
|
||||
buf->appendToChain(cryptoState->oneRttStream.writeBuffer.move());
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
|
||||
@@ -4668,7 +4668,7 @@ TEST_F(QuicUnencryptedServerTransportTest, TestGarbageData) {
|
||||
0 /* largestAcked */);
|
||||
auto packetData =
|
||||
packetToBufCleartext(packet, *aead, *headerCipher, nextPacket);
|
||||
packetData->prependChain(IOBuf::copyBuffer("garbage in"));
|
||||
packetData->appendToChain(IOBuf::copyBuffer("garbage in"));
|
||||
deliverData(std::move(packetData));
|
||||
EXPECT_NE(server->getConn().readCodec, nullptr);
|
||||
EXPECT_NE(server->getConn().initialWriteCipher, nullptr);
|
||||
|
||||
@@ -590,7 +590,7 @@ class QuicServerTransportTestBase : public virtual testing::Test {
|
||||
if (frame.type() != QuicFrame::Type::ReadCryptoFrame) {
|
||||
continue;
|
||||
}
|
||||
cryptoBuf->prependChain(frame.asReadCryptoFrame()->data->clone());
|
||||
cryptoBuf->appendToChain(frame.asReadCryptoFrame()->data->clone());
|
||||
}
|
||||
}
|
||||
return cryptoBuf;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace {
|
||||
void prependToBuf(quic::BufPtr& buf, quic::BufPtr toAppend) {
|
||||
if (buf) {
|
||||
buf->prependChain(std::move(toAppend));
|
||||
buf->appendToChain(std::move(toAppend));
|
||||
} else {
|
||||
buf = std::move(toAppend);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ TEST_P(QuicStreamFunctionsTestBase, TestWriteStream) {
|
||||
ASSERT_FALSE(writeDataToQuicStream(*stream, buf2->clone(), false).hasError());
|
||||
|
||||
IOBufEqualTo eq;
|
||||
buf1->prependChain(std::move(buf2));
|
||||
buf1->appendToChain(std::move(buf2));
|
||||
|
||||
EXPECT_TRUE(eq(stream->writeBuffer.move(), buf1));
|
||||
}
|
||||
@@ -148,10 +148,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataWrittenInOrder) {
|
||||
auto streamLastMaxOffset = stream->maxOffsetObserved;
|
||||
auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset;
|
||||
auto buf1 = IOBuf::copyBuffer("I just met you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("Here's my number ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
|
||||
ASSERT_FALSE(appendDataToReadBuffer(*stream, StreamBuffer(buf1->clone(), 0))
|
||||
.hasError());
|
||||
@@ -187,10 +187,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestPeekAndConsumeContiguousData) {
|
||||
auto streamLastMaxOffset = stream->maxOffsetObserved;
|
||||
auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset;
|
||||
auto buf1 = IOBuf::copyBuffer("I just met you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("Here's my number ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
|
||||
ASSERT_FALSE(appendDataToReadBuffer(*stream, StreamBuffer(buf1->clone(), 0))
|
||||
.hasError());
|
||||
@@ -238,10 +238,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestPeekAndConsumeNonContiguousData) {
|
||||
auto streamLastMaxOffset = stream->maxOffsetObserved;
|
||||
auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset;
|
||||
auto buf1 = IOBuf::copyBuffer("I just met you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("'s my number ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
|
||||
ASSERT_FALSE(appendDataToReadBuffer(*stream, StreamBuffer(buf1->clone(), 0))
|
||||
.hasError());
|
||||
@@ -373,10 +373,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestPeekAndConsumeEmptyDataEof) {
|
||||
TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufs) {
|
||||
auto stream = conn.streamManager->createNextBidirectionalStream().value();
|
||||
auto buf1 = IOBuf::copyBuffer("I just met you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("Here's my number ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
|
||||
auto streamLastMaxOffset = stream->maxOffsetObserved;
|
||||
auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset;
|
||||
@@ -407,11 +407,11 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufs) {
|
||||
TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufsShared) {
|
||||
auto stream = conn.streamManager->createNextBidirectionalStream().value();
|
||||
auto buf1 = IOBuf::copyBuffer("I just met you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->coalesceWithHeadroomTailroom(0, 8000);
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("Here's my number ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
|
||||
// Manually share the buffers like multiple stream frames in a packet.
|
||||
auto buf3 = buf1->clone();
|
||||
@@ -454,10 +454,10 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataFromMultipleBufsShared) {
|
||||
TEST_P(QuicStreamFunctionsTestBase, TestReadDataOutOfOrder) {
|
||||
auto stream = conn.streamManager->createNextBidirectionalStream().value();
|
||||
auto buf1 = IOBuf::copyBuffer(" you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this is crazy. "));
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("Here's my number ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("so call me maybe"));
|
||||
auto streamLastMaxOffset = stream->maxOffsetObserved;
|
||||
auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset;
|
||||
|
||||
@@ -496,13 +496,13 @@ TEST_P(QuicStreamFunctionsTestBase, TestReadDataOutOfOrder) {
|
||||
TEST_P(QuicStreamFunctionsTestBase, TestReadOverlappingData) {
|
||||
auto stream = conn.streamManager->createNextBidirectionalStream().value();
|
||||
auto buf1 = IOBuf::copyBuffer("I just met you ");
|
||||
buf1->prependChain(IOBuf::copyBuffer("and this"));
|
||||
buf1->appendToChain(IOBuf::copyBuffer("and this"));
|
||||
|
||||
auto buf2 = IOBuf::copyBuffer("met you and this is crazy. ");
|
||||
buf2->prependChain(IOBuf::copyBuffer("Here's my number"));
|
||||
buf2->appendToChain(IOBuf::copyBuffer("Here's my number"));
|
||||
|
||||
auto buf3 = IOBuf::copyBuffer("Here's my number, ");
|
||||
buf3->prependChain(IOBuf::copyBuffer("so call me maybe."));
|
||||
buf3->appendToChain(IOBuf::copyBuffer("so call me maybe."));
|
||||
|
||||
auto streamLastMaxOffset = stream->maxOffsetObserved;
|
||||
auto connLastMaxOffset = conn.flowControlState.sumMaxObservedOffset;
|
||||
@@ -737,7 +737,7 @@ TEST_P(QuicStreamFunctionsTestBase, TestInsertVariations) {
|
||||
auto buf6 = IOBuf::copyBuffer(" me maybe");
|
||||
auto buf7 = IOBuf::copyBuffer("this is crazy. Here's my number so call");
|
||||
auto buf8 = IOBuf::copyBuffer("I just met you");
|
||||
buf8->prependChain(IOBuf::copyBuffer(" and this"));
|
||||
buf8->appendToChain(IOBuf::copyBuffer(" and this"));
|
||||
auto buf9 = IOBuf::copyBuffer("Here's my number so call me maybe");
|
||||
auto buf10 = IOBuf::copyBuffer("I ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user