1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2026-01-06 03:41:10 +03:00

Further stream manager cleanups.

Summary:
Turns out we weren't removing all the state from closed streams that we should have been.

Additionally, getStream can return `nullptr`. It is up to the caller to either check this or check `streamExists` first.

Reviewed By: yangchi

Differential Revision: D21047999

fbshipit-source-id: b477d44cfb02d5e1e3e8a805ab94bba87f1e8f1b
This commit is contained in:
Matt Joras
2020-04-15 18:47:02 -07:00
committed by Facebook GitHub Bot
parent dc0fff83ff
commit 08ff75df2d
3 changed files with 10 additions and 1 deletions

View File

@@ -412,6 +412,9 @@ void QuicStreamManager::removeClosedStream(StreamId streamId) {
windowUpdates_.erase(streamId);
lossStreams_.erase(streamId);
stopSendingStreams_.erase(streamId);
flowControlUpdated_.erase(streamId);
dataRejectedStreams_.erase(streamId);
dataExpiredStreams_.erase(streamId);
if (it->second.isControl) {
DCHECK_GT(numControlStreams_, 0);
numControlStreams_--;

View File

@@ -80,7 +80,7 @@ class QuicStreamManager {
* Return the stream state or create it if the state has not yet been created.
* Note that this is only valid for streams that are currently open.
*/
QuicStreamState* FOLLY_NONNULL getStream(StreamId streamId);
QuicStreamState* getStream(StreamId streamId);
/*
* Remove all the state for a stream that is being closed.

View File

@@ -1537,6 +1537,9 @@ TEST_F(QuicStreamFunctionsTest, RemovedClosedState) {
conn.streamManager->queueWindowUpdate(streamId);
conn.streamManager->addStopSending(
streamId, GenericApplicationErrorCode::UNKNOWN);
conn.streamManager->queueFlowControlUpdated(streamId);
conn.streamManager->addDataRejected(streamId);
conn.streamManager->addDataExpired(streamId);
stream->sendState = StreamSendState::Closed_E;
stream->recvState = StreamRecvState::Closed_E;
conn.streamManager->removeClosedStream(streamId);
@@ -1549,6 +1552,9 @@ TEST_F(QuicStreamFunctionsTest, RemovedClosedState) {
EXPECT_FALSE(conn.streamManager->hasLoss());
EXPECT_FALSE(conn.streamManager->pendingWindowUpdate(streamId));
EXPECT_TRUE(conn.streamManager->stopSendingStreams().empty());
EXPECT_FALSE(conn.streamManager->flowControlUpdatedContains(streamId));
EXPECT_TRUE(conn.streamManager->dataRejectedStreams().empty());
EXPECT_TRUE(conn.streamManager->dataExpiredStreams().empty());
}
TEST_F(QuicServerStreamFunctionsTest, ServerGetClientQuicStream) {