mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-09 10:00:57 +03:00
Add a useSplitConnectionCallbacks to mvfst
Summary: This change just adds a (currently no-op) flag that will be used in diffs up the stack. The idea here is that I'll add split QUIC connection callback interfaces that will live side by side with existing single monolithic callback for now. We will experiment with split callbacks on small scale to see that there is no regressions and then will phase out the old callback gradually. This flag is to control which callback(s) to use. Reviewed By: mjoras Differential Revision: D30399667 fbshipit-source-id: 8fc4e4a005e93cf6d48a987f49edee33b90dbbf1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6659296aed
commit
21ea1990ab
@@ -29,7 +29,8 @@ namespace quic {
|
||||
|
||||
QuicTransportBase::QuicTransportBase(
|
||||
folly::EventBase* evb,
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket)
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
bool useSplitConnectionCallbacks)
|
||||
: evb_(evb),
|
||||
socket_(std::move(socket)),
|
||||
lossTimeout_(this),
|
||||
@@ -52,7 +53,8 @@ QuicTransportBase::QuicTransportBase(
|
||||
writeLooper_(new FunctionLooper(
|
||||
evb,
|
||||
[this](bool fromTimer) { pacedWriteDataToSocket(fromTimer); },
|
||||
LooperType::WriteLooper)) {
|
||||
LooperType::WriteLooper)),
|
||||
useSplitConnectionCallbacks_(useSplitConnectionCallbacks) {
|
||||
writeLooper_->setPacingFunction([this]() -> auto {
|
||||
if (isConnectionPaced(*conn_)) {
|
||||
return conn_->pacer->getTimeUntilNextWrite();
|
||||
|
||||
@@ -39,7 +39,8 @@ class QuicTransportBase : public QuicSocket {
|
||||
public:
|
||||
QuicTransportBase(
|
||||
folly::EventBase* evb,
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket);
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
bool useSplitConnectionCallbacks = false);
|
||||
|
||||
~QuicTransportBase() override;
|
||||
|
||||
@@ -875,6 +876,11 @@ class QuicTransportBase : public QuicSocket {
|
||||
std::shared_ptr<ObserverVec> observers_{std::make_shared<ObserverVec>()};
|
||||
|
||||
uint64_t qlogRefcnt_{0};
|
||||
|
||||
// Temp flag controlling which connection callbacks to use - old single
|
||||
// callback object or two new split callback objects. Will be removed out once
|
||||
// mvfst is switched to the new split callbacks eventually.
|
||||
bool useSplitConnectionCallbacks_{false};
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const QuicTransportBase& qt);
|
||||
|
||||
@@ -39,12 +39,14 @@ QuicClientTransport::QuicClientTransport(
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
std::shared_ptr<ClientHandshakeFactory> handshakeFactory,
|
||||
size_t connectionIdSize,
|
||||
PacketNum startingPacketNum)
|
||||
PacketNum startingPacketNum,
|
||||
bool useSplitConnectionCallbacks)
|
||||
: QuicClientTransport(
|
||||
evb,
|
||||
std::move(socket),
|
||||
std::move(handshakeFactory),
|
||||
connectionIdSize) {
|
||||
connectionIdSize,
|
||||
useSplitConnectionCallbacks) {
|
||||
conn_->ackStates = AckStates(startingPacketNum);
|
||||
}
|
||||
|
||||
@@ -52,8 +54,9 @@ QuicClientTransport::QuicClientTransport(
|
||||
folly::EventBase* evb,
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
std::shared_ptr<ClientHandshakeFactory> handshakeFactory,
|
||||
size_t connectionIdSize)
|
||||
: QuicTransportBase(evb, std::move(socket)),
|
||||
size_t connectionIdSize,
|
||||
bool useSplitConnectionCallbacks)
|
||||
: QuicTransportBase(evb, std::move(socket), useSplitConnectionCallbacks),
|
||||
happyEyeballsConnAttemptDelayTimeout_(this) {
|
||||
DCHECK(handshakeFactory);
|
||||
auto tempConn =
|
||||
|
||||
@@ -32,7 +32,8 @@ class QuicClientTransport
|
||||
folly::EventBase* evb,
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
std::shared_ptr<ClientHandshakeFactory> handshakeFactory,
|
||||
size_t connectionIdSize = 0);
|
||||
size_t connectionIdSize = 0,
|
||||
bool useSplitConnectionCallbacks = false);
|
||||
|
||||
// Testing only API:
|
||||
QuicClientTransport(
|
||||
@@ -40,7 +41,8 @@ class QuicClientTransport
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
std::shared_ptr<ClientHandshakeFactory> handshakeFactory,
|
||||
size_t connectionIdSize,
|
||||
PacketNum startingPacketNum);
|
||||
PacketNum startingPacketNum,
|
||||
bool useSplitConnectionCallbacks = false);
|
||||
|
||||
~QuicClientTransport() override;
|
||||
|
||||
@@ -59,9 +61,14 @@ class QuicClientTransport
|
||||
folly::EventBase* evb,
|
||||
std::unique_ptr<folly::AsyncUDPSocket> sock,
|
||||
std::shared_ptr<ClientHandshakeFactory> handshakeFactory,
|
||||
size_t connectionIdSize = 0) {
|
||||
size_t connectionIdSize = 0,
|
||||
bool useSplitConnectionCallbacks = false) {
|
||||
auto client = std::make_shared<TransportType>(
|
||||
evb, std::move(sock), std::move(handshakeFactory), connectionIdSize);
|
||||
evb,
|
||||
std::move(sock),
|
||||
std::move(handshakeFactory),
|
||||
connectionIdSize,
|
||||
useSplitConnectionCallbacks);
|
||||
client->setSelfOwning();
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -85,12 +85,14 @@ class TestingQuicClientTransport : public QuicClientTransport {
|
||||
folly::EventBase* evb,
|
||||
std::unique_ptr<folly::AsyncUDPSocket> socket,
|
||||
std::shared_ptr<ClientHandshakeFactory> handshakeFactory,
|
||||
size_t connIdSize = kDefaultConnectionIdSize)
|
||||
size_t connIdSize = kDefaultConnectionIdSize,
|
||||
bool useSplitConnectionCallbacks = false)
|
||||
: QuicClientTransport(
|
||||
evb,
|
||||
std::move(socket),
|
||||
std::move(handshakeFactory),
|
||||
connIdSize) {}
|
||||
connIdSize,
|
||||
useSplitConnectionCallbacks) {}
|
||||
|
||||
~TestingQuicClientTransport() override {
|
||||
if (destructionCallback_) {
|
||||
|
||||
@@ -43,7 +43,11 @@ QuicServerTransport::QuicServerTransport(
|
||||
ConnectionCallback& cb,
|
||||
std::shared_ptr<const fizz::server::FizzServerContext> ctx,
|
||||
std::unique_ptr<CryptoFactory> cryptoFactory)
|
||||
: QuicTransportBase(evb, std::move(sock)), ctx_(std::move(ctx)) {
|
||||
: QuicTransportBase(
|
||||
evb,
|
||||
std::move(sock),
|
||||
false /* useSplitConnectionCallbacks */),
|
||||
ctx_(std::move(ctx)) {
|
||||
auto tempConn = std::make_unique<QuicServerConnectionState>(
|
||||
FizzServerQuicHandshakeContext::Builder()
|
||||
.setFizzServerContext(ctx_)
|
||||
|
||||
Reference in New Issue
Block a user