1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-08 09:42:06 +03:00

Use separate flags to enable app data sent callbacks

Summary:
Previously we were using a single flag appDataSentEvents to enable 3 callbacks
(startWritingFromAppLimited, packetsWritten and appRateLimited). This commit
creates separate flags to enable each of these callbacks, we have use-cases
where Observers might want only packetsWritten events and not the others.

Also, this commit refactors the logic to deliver these 3 callbacks to all
observers into a separate method so they can be unit tested easily.

Reviewed By: bschlinker

Differential Revision: D27925011

fbshipit-source-id: 7f7436dfc3d50c3abcb8ec121b221d20e30b0c4b
This commit is contained in:
Sridhar Srinivasan
2021-05-02 23:06:59 -07:00
committed by Facebook GitHub Bot
parent 1bfb6b25e3
commit 3a4783713a
6 changed files with 74 additions and 38 deletions

View File

@@ -357,8 +357,8 @@ TEST_F(QuicTransportTest, NotAppLimitedWithNoWritableBytesWithObservers) {
}));
Observer::Config config = {};
config.appLimitedEvents = true;
config.appDataSentEvents = true;
config.packetsWrittenEvents = true;
config.appRateLimitedEvents = true;
auto cb = std::make_unique<StrictMock<MockObserver>>(config);
EXPECT_CALL(*cb, observerAttach(transport_.get()));
@@ -390,8 +390,8 @@ TEST_F(QuicTransportTest, NotAppLimitedWithLargeBufferWithObservers) {
.WillRepeatedly(Return(5000));
Observer::Config config = {};
config.appLimitedEvents = true;
config.appDataSentEvents = true;
config.packetsWrittenEvents = true;
config.appRateLimitedEvents = true;
auto cb = std::make_unique<StrictMock<MockObserver>>(config);
EXPECT_CALL(*cb, observerAttach(transport_.get()));
@@ -414,8 +414,8 @@ TEST_F(QuicTransportTest, NotAppLimitedWithLargeBufferWithObservers) {
TEST_F(QuicTransportTest, AppLimitedWithObservers) {
Observer::Config config = {};
config.appLimitedEvents = true;
config.appDataSentEvents = true;
config.packetsWrittenEvents = true;
config.appRateLimitedEvents = true;
auto cb1 = std::make_unique<StrictMock<MockObserver>>(config);
auto cb2 = std::make_unique<StrictMock<MockObserver>>(config);
EXPECT_CALL(*cb1, observerAttach(transport_.get()));