1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-12-24 09:40:59 +03:00

get rid of callbacks indirection layer

Summary: get rid of callbacks indirection layer

Reviewed By: mjoras

Differential Revision: D34189595

fbshipit-source-id: e4a0aba768b17054f06091c12ef66f1a8019885f
This commit is contained in:
Konstantin Tsoy
2022-02-15 11:42:06 -08:00
committed by Facebook GitHub Bot
parent 3872f0dd89
commit 54ce32396c
4 changed files with 40 additions and 138 deletions

View File

@@ -766,18 +766,19 @@ void QuicClientTransport::onReadData(
}
bool waitingForFirstPacket = !hasReceivedPackets(*conn_);
processUDPData(peer, std::move(networkData));
if (connCallback_ && waitingForFirstPacket && hasReceivedPackets(*conn_)) {
connCallback_->onFirstPeerPacketProcessed();
if (connSetupCallback_ && waitingForFirstPacket &&
hasReceivedPackets(*conn_)) {
connSetupCallback_->onFirstPeerPacketProcessed();
}
if (!transportReadyNotified_ && hasWriteCipher()) {
transportReadyNotified_ = true;
connCallback_->onTransportReady();
connSetupCallback_->onTransportReady();
}
// Checking connCallback_ because application will start to write data
// Checking connSetupCallback_ because application will start to write data
// in onTransportReady, if the write fails, QuicSocket can be closed
// and connCallback_ is set nullptr.
if (connCallback_ && !replaySafeNotified_ && conn_->oneRttWriteCipher) {
// and connSetupCallback_ is set nullptr.
if (connSetupCallback_ && !replaySafeNotified_ && conn_->oneRttWriteCipher) {
// If there is 0RTT data still outstanding, opportunistically retransmit
// it rather than waiting for the loss recovery.
if (conn_->transportSettings.earlyRetransmit0Rtt) {
@@ -787,7 +788,7 @@ void QuicClientTransport::onReadData(
// We don't need this any more. Also unset it so that we don't allow random
// middleboxes to shutdown our connection once we have crypto keys.
socket_->setErrMessageCallback(nullptr);
connCallback_->onReplaySafe();
connSetupCallback_->onReplaySafe();
}
maybeSendTransportKnobs();
@@ -998,8 +999,8 @@ void QuicClientTransport::startCryptoHandshake() {
transportReadyNotified_ = true;
runOnEvbAsync([](auto self) {
auto clientPtr = static_cast<QuicClientTransport*>(self.get());
if (clientPtr->connCallback_) {
clientPtr->connCallback_->onTransportReady();
if (clientPtr->connSetupCallback_) {
clientPtr->connSetupCallback_->onTransportReady();
}
});
}