mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-05 11:21:09 +03:00
Add open_streams metric
Summary: I want to have visibility in to the current count of streams. There are already callback methods onNew/onClosed, unfortunately, the latter is not called when connections are closed, so I had to fix that to prevent the metric from uncontrolled growth. I am still not positive it's correct and was thinking of hooking into QuicStreamState destructor instead. Reviewed By: kvtsoy Differential Revision: D56195487 fbshipit-source-id: 901bce9473327a8f7ef1bc0f70af10899784d681
This commit is contained in:
committed by
Facebook GitHub Bot
parent
688743070d
commit
16501032fa
@@ -4757,5 +4757,45 @@ TEST_F(
|
||||
expectedSignal.maybeBytesToSend, congestionControlWritableBytes(*conn));
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
QuicTransportFunctionsTest,
|
||||
onQuicStreamClosedNotCalledOnStreamClearing) {
|
||||
{
|
||||
auto conn = createConn();
|
||||
EXPECT_CALL(*quicStats_, onNewQuicStream()).Times(1);
|
||||
EXPECT_CALL(*quicStats_, onQuicStreamClosed()).Times(1);
|
||||
auto stream = conn->streamManager->createNextBidirectionalStream().value();
|
||||
EXPECT_EQ(stream->id, 1);
|
||||
EXPECT_EQ(conn->streamManager->streamCount(), 1);
|
||||
conn->streamManager->clearOpenStreams();
|
||||
EXPECT_EQ(conn->streamManager->streamCount(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportFunctionsTest, onQuicStreamClosedCalledOnConnClosure) {
|
||||
{
|
||||
auto conn = createConn();
|
||||
EXPECT_CALL(*quicStats_, onNewQuicStream()).Times(1);
|
||||
EXPECT_CALL(*quicStats_, onQuicStreamClosed()).Times(1);
|
||||
auto stream = conn->streamManager->createNextBidirectionalStream().value();
|
||||
EXPECT_EQ(stream->id, 1);
|
||||
EXPECT_EQ(conn->streamManager->streamCount(), 1);
|
||||
conn.reset();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportFunctionsTest, onQuicStreamClosed) {
|
||||
auto conn = createConn();
|
||||
EXPECT_CALL(*quicStats_, onNewQuicStream()).Times(1);
|
||||
EXPECT_CALL(*quicStats_, onQuicStreamClosed()).Times(1);
|
||||
auto stream = conn->streamManager->createNextBidirectionalStream().value();
|
||||
EXPECT_EQ(stream->id, 1);
|
||||
EXPECT_EQ(conn->streamManager->streamCount(), 1);
|
||||
stream->sendState = StreamSendState::Closed;
|
||||
stream->recvState = StreamRecvState::Closed;
|
||||
conn->streamManager->removeClosedStream(stream->id);
|
||||
EXPECT_EQ(conn->streamManager->streamCount(), 0);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace quic
|
||||
|
Reference in New Issue
Block a user