mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-07-29 03:41:11 +03:00
Reset values properly in HTTPPriorityQueue::clear()
Summary: Fixing bug where `HTTPPriorityQueue::clear()` doesn't properly reset `roundRobinElements_` and `lowestRoundRobin_`. Reviewed By: hanidamlaj Differential Revision: D76171861 fbshipit-source-id: fc408471be75e42abda934f79493bb801c2258dc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
be23e87323
commit
d00df1332b
@ -167,6 +167,8 @@ void HTTPPriorityQueue::clear() {
|
|||||||
for (auto& rr : roundRobins_) {
|
for (auto& rr : roundRobins_) {
|
||||||
rr.clear();
|
rr.clear();
|
||||||
}
|
}
|
||||||
|
roundRobinElements_ = 0;
|
||||||
|
lowestRoundRobin_ = roundRobins_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const HTTPPriorityQueue::Element* FOLLY_NULLABLE
|
const HTTPPriorityQueue::Element* FOLLY_NULLABLE
|
||||||
|
@ -21,6 +21,16 @@ class HTTPPriorityQueueTest : public testing::Test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(HTTPPriorityQueueTest, EmptyQueue) {
|
TEST_F(HTTPPriorityQueueTest, EmptyQueue) {
|
||||||
|
queue_.clear();
|
||||||
|
EXPECT_TRUE(queue_.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(HTTPPriorityQueueTest, IncrementalEmptyQueue) {
|
||||||
|
auto id = Identifier::fromStreamID(1);
|
||||||
|
auto priority = HTTPPriorityQueue::Priority(0, true);
|
||||||
|
queue_.insertOrUpdate(id, priority);
|
||||||
|
EXPECT_FALSE(queue_.empty());
|
||||||
|
queue_.clear();
|
||||||
EXPECT_TRUE(queue_.empty());
|
EXPECT_TRUE(queue_.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user