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:
committed by
Facebook GitHub Bot
parent
955f05f42b
commit
aa90d99d76
@@ -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 {
|
Optional<ConnectionId> QuicTransportBase::getClientConnectionId() const {
|
||||||
return conn_->clientConnectionId;
|
return conn_->clientConnectionId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ class QuicTransportBase : public QuicSocket,
|
|||||||
|
|
||||||
Optional<ConnectionId> getClientChosenDestConnectionId() const override;
|
Optional<ConnectionId> getClientChosenDestConnectionId() const override;
|
||||||
|
|
||||||
const std::shared_ptr<QLogger> getQLogger() const;
|
|
||||||
|
|
||||||
// QuicSocket interface
|
// QuicSocket interface
|
||||||
bool replaySafe() const override;
|
bool replaySafe() const override;
|
||||||
|
|
||||||
@@ -169,8 +167,6 @@ class QuicTransportBase : public QuicSocket,
|
|||||||
ApplicationErrorCode error,
|
ApplicationErrorCode error,
|
||||||
folly::StringPiece errorMsg) override;
|
folly::StringPiece errorMsg) override;
|
||||||
|
|
||||||
virtual void setQLogger(std::shared_ptr<QLogger> qLogger);
|
|
||||||
|
|
||||||
void setLoopDetectorCallback(std::shared_ptr<LoopDetectorCallback> callback) {
|
void setLoopDetectorCallback(std::shared_ptr<LoopDetectorCallback> callback) {
|
||||||
conn_->loopDetectorCallback = std::move(callback);
|
conn_->loopDetectorCallback = std::move(callback);
|
||||||
}
|
}
|
||||||
@@ -255,8 +251,6 @@ class QuicTransportBase : public QuicSocket,
|
|||||||
|
|
||||||
bool handshakeDoneNotified_{false};
|
bool handshakeDoneNotified_{false};
|
||||||
|
|
||||||
uint64_t qlogRefcnt_{0};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Helper to check if using custom retransmission profiles is feasible.
|
* Helper to check if using custom retransmission profiles is feasible.
|
||||||
|
|||||||
@@ -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>
|
folly::Expected<folly::Unit, LocalErrorCode>
|
||||||
QuicTransportBaseLite::setStreamPriority(StreamId id, Priority priority) {
|
QuicTransportBaseLite::setStreamPriority(StreamId id, Priority priority) {
|
||||||
if (closeState_ != CloseState::OPEN) {
|
if (closeState_ != CloseState::OPEN) {
|
||||||
|
|||||||
@@ -170,6 +170,10 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
|
|||||||
StreamId id,
|
StreamId id,
|
||||||
size_t maxLen) override;
|
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 setReceiveWindow(StreamId, size_t /*recvWindowSize*/) override {}
|
||||||
|
|
||||||
void setSendBuffer(StreamId, size_t /*maxUnacked*/, size_t /*maxUnsent*/)
|
void setSendBuffer(StreamId, size_t /*maxUnacked*/, size_t /*maxUnsent*/)
|
||||||
@@ -922,6 +926,8 @@ class QuicTransportBaseLite : virtual public QuicSocketLite,
|
|||||||
* additionalCmsgs callback
|
* additionalCmsgs callback
|
||||||
*/
|
*/
|
||||||
void updatePacketProcessorsPrewriteRequests();
|
void updatePacketProcessorsPrewriteRequests();
|
||||||
|
|
||||||
|
uint64_t qlogRefcnt_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const QuicTransportBaseLite& qt);
|
std::ostream& operator<<(std::ostream& os, const QuicTransportBaseLite& qt);
|
||||||
|
|||||||
Reference in New Issue
Block a user