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

onStreamPreReaped

Summary: Move the callback to before the stream is destroyed.

Reviewed By: jbeshay

Differential Revision: D52127833

fbshipit-source-id: 1a9dbcf9ad92dbdb4e15409a418307dc6852b091
This commit is contained in:
Matt Joras
2023-12-13 11:19:53 -08:00
committed by Facebook GitHub Bot
parent 9285422f2a
commit f7a59e8465
4 changed files with 8 additions and 7 deletions

View File

@@ -132,10 +132,11 @@ class QuicSocket {
StreamGroupId) noexcept {}
/**
* Invoked when a given stream has been closed and its state reaped by
* the transport. After this point no operations can be done on the stream.
* Invoked when a given stream has been closed and its state is about to
* be reaped by the transport. This is the last chance to do any final
* state querying operations on the stream.
*/
virtual void onStreamStateReaped(StreamId) noexcept {}
virtual void onStreamPreReaped(StreamId) noexcept {}
/**
* Invoked when a stream receives a StopSending frame from a peer.

View File

@@ -2610,10 +2610,10 @@ void QuicTransportBase::checkForClosedStream() {
conn_->qLogger->addTransportStateUpdate(
getClosingStream(folly::to<std::string>(*itr)));
}
conn_->streamManager->removeClosedStream(*itr);
if (connCallback_) {
connCallback_->onStreamStateReaped(*itr);
connCallback_->onStreamPreReaped(*itr);
}
conn_->streamManager->removeClosedStream(*itr);
maybeSendStreamLimitUpdates(*conn_);
if (readCbIt != readCallbacks_.end()) {
readCallbacks_.erase(readCbIt);

View File

@@ -123,7 +123,7 @@ class MockConnectionCallback : public QuicSocket::ConnectionCallback {
onNewUnidirectionalStreamInGroup,
(StreamId, StreamGroupId),
(noexcept));
MOCK_METHOD((void), onStreamStateReaped, (StreamId), (noexcept));
MOCK_METHOD((void), onStreamPreReaped, (StreamId), (noexcept));
MOCK_METHOD(
(void),
onStopSending,

View File

@@ -1743,7 +1743,7 @@ TEST_P(QuicTransportImplTestBase, CloseStreamAfterReadError) {
transport->closeStream(stream1);
EXPECT_CALL(readCb1, readError(stream1, IsError(LocalErrorCode::NO_ERROR)));
EXPECT_CALL(connCallback, onStreamStateReaped(stream1));
EXPECT_CALL(connCallback, onStreamPreReaped(stream1));
transport->driveReadCallbacks();
EXPECT_FALSE(transport->transportConn->streamManager->streamExists(stream1));