1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-27 03:41:14 +03:00

move qlog to transport lite

Summary:
Context: T210787480

I want to add a client-side qlog that will allow us to inspect client behavior during the 0rtt bug.

Reviewed By: jbeshay

Differential Revision: D71145234

fbshipit-source-id: 7816f0a759ba4f60107aaf40c4376ced7c5d03f8
This commit is contained in:
Paul Farcasanu
2025-04-01 20:10:07 -07:00
committed by Facebook GitHub Bot
parent 955f05f42b
commit aa90d99d76
4 changed files with 40 additions and 40 deletions

View File

@@ -57,40 +57,6 @@ void QuicTransportBase::setPacingTimer(
}
}
const std::shared_ptr<QLogger> QuicTransportBase::getQLogger() const {
return conn_->qLogger;
}
void QuicTransportBase::setQLogger(std::shared_ptr<QLogger> qLogger) {
// setQLogger can be called multiple times for the same connection and with
// the same qLogger we track the number of times it gets set and the number
// of times it gets reset, and only stop qlog collection when the number of
// resets equals the number of times the logger was set
if (!conn_->qLogger) {
CHECK_EQ(qlogRefcnt_, 0);
} else {
CHECK_GT(qlogRefcnt_, 0);
}
if (qLogger) {
conn_->qLogger = std::move(qLogger);
conn_->qLogger->setDcid(conn_->clientChosenDestConnectionId);
if (conn_->nodeType == QuicNodeType::Server) {
conn_->qLogger->setScid(conn_->serverConnectionId);
} else {
conn_->qLogger->setScid(conn_->clientConnectionId);
}
qlogRefcnt_++;
} else {
if (conn_->qLogger) {
qlogRefcnt_--;
if (qlogRefcnt_ == 0) {
conn_->qLogger = nullptr;
}
}
}
}
Optional<ConnectionId> QuicTransportBase::getClientConnectionId() const {
return conn_->clientConnectionId;
}

View File

@@ -51,8 +51,6 @@ class QuicTransportBase : public QuicSocket,
Optional<ConnectionId> getClientChosenDestConnectionId() const override;
const std::shared_ptr<QLogger> getQLogger() const;
// QuicSocket interface
bool replaySafe() const override;
@@ -169,8 +167,6 @@ class QuicTransportBase : public QuicSocket,
ApplicationErrorCode error,
folly::StringPiece errorMsg) override;
virtual void setQLogger(std::shared_ptr<QLogger> qLogger);
void setLoopDetectorCallback(std::shared_ptr<LoopDetectorCallback> callback) {
conn_->loopDetectorCallback = std::move(callback);
}
@@ -255,8 +251,6 @@ class QuicTransportBase : public QuicSocket,
bool handshakeDoneNotified_{false};
uint64_t qlogRefcnt_{0};
private:
/**
* Helper to check if using custom retransmission profiles is feasible.

View File

@@ -753,6 +753,40 @@ QuicTransportBaseLite::read(StreamId id, size_t maxLen) {
}
}
void QuicTransportBaseLite::setQLogger(std::shared_ptr<QLogger> qLogger) {
// setQLogger can be called multiple times for the same connection and with
// the same qLogger we track the number of times it gets set and the number
// of times it gets reset, and only stop qlog collection when the number of
// resets equals the number of times the logger was set
if (!conn_->qLogger) {
CHECK_EQ(qlogRefcnt_, 0);
} else {
CHECK_GT(qlogRefcnt_, 0);
}
if (qLogger) {
conn_->qLogger = std::move(qLogger);
conn_->qLogger->setDcid(conn_->clientChosenDestConnectionId);
if (conn_->nodeType == QuicNodeType::Server) {
conn_->qLogger->setScid(conn_->serverConnectionId);
} else {
conn_->qLogger->setScid(conn_->clientConnectionId);
}
qlogRefcnt_++;
} else {
if (conn_->qLogger) {
qlogRefcnt_--;
if (qlogRefcnt_ == 0) {
conn_->qLogger = nullptr;
}
}
}
}
const std::shared_ptr<QLogger> QuicTransportBaseLite::getQLogger() const {
return conn_->qLogger;
}
folly::Expected<folly::Unit, LocalErrorCode>
QuicTransportBaseLite::setStreamPriority(StreamId id, Priority priority) {
if (closeState_ != CloseState::OPEN) {

View File

@@ -170,6 +170,10 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
StreamId id,
size_t maxLen) override;
virtual void setQLogger(std::shared_ptr<QLogger> qLogger);
[[nodiscard]] const std::shared_ptr<QLogger> getQLogger() const;
void setReceiveWindow(StreamId, size_t /*recvWindowSize*/) override {}
void setSendBuffer(StreamId, size_t /*maxUnacked*/, size_t /*maxUnsent*/)
@@ -922,6 +926,8 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
* additionalCmsgs callback
*/
void updatePacketProcessorsPrewriteRequests();
uint64_t qlogRefcnt_{0};
};
std::ostream& operator<<(std::ostream& os, const QuicTransportBaseLite& qt);