mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Add onStreamPreReaped.
Summary: This is potentially useful to an application to know when the underlying stream state has been freed by the transport. Reviewed By: jbeshay Differential Revision: D52048888 fbshipit-source-id: e7b2d33c3702ce8aa348459a37094198d16af60f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
62af5ab602
commit
9285422f2a
@@ -131,6 +131,12 @@ class QuicSocket {
|
|||||||
StreamId,
|
StreamId,
|
||||||
StreamGroupId) noexcept {}
|
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.
|
||||||
|
*/
|
||||||
|
virtual void onStreamStateReaped(StreamId) noexcept {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when a stream receives a StopSending frame from a peer.
|
* Invoked when a stream receives a StopSending frame from a peer.
|
||||||
* The application should reset the stream as part of this callback.
|
* The application should reset the stream as part of this callback.
|
||||||
|
@@ -2611,6 +2611,9 @@ void QuicTransportBase::checkForClosedStream() {
|
|||||||
getClosingStream(folly::to<std::string>(*itr)));
|
getClosingStream(folly::to<std::string>(*itr)));
|
||||||
}
|
}
|
||||||
conn_->streamManager->removeClosedStream(*itr);
|
conn_->streamManager->removeClosedStream(*itr);
|
||||||
|
if (connCallback_) {
|
||||||
|
connCallback_->onStreamStateReaped(*itr);
|
||||||
|
}
|
||||||
maybeSendStreamLimitUpdates(*conn_);
|
maybeSendStreamLimitUpdates(*conn_);
|
||||||
if (readCbIt != readCallbacks_.end()) {
|
if (readCbIt != readCallbacks_.end()) {
|
||||||
readCallbacks_.erase(readCbIt);
|
readCallbacks_.erase(readCbIt);
|
||||||
|
@@ -123,6 +123,7 @@ class MockConnectionCallback : public QuicSocket::ConnectionCallback {
|
|||||||
onNewUnidirectionalStreamInGroup,
|
onNewUnidirectionalStreamInGroup,
|
||||||
(StreamId, StreamGroupId),
|
(StreamId, StreamGroupId),
|
||||||
(noexcept));
|
(noexcept));
|
||||||
|
MOCK_METHOD((void), onStreamStateReaped, (StreamId), (noexcept));
|
||||||
MOCK_METHOD(
|
MOCK_METHOD(
|
||||||
(void),
|
(void),
|
||||||
onStopSending,
|
onStopSending,
|
||||||
|
@@ -1743,6 +1743,7 @@ TEST_P(QuicTransportImplTestBase, CloseStreamAfterReadError) {
|
|||||||
transport->closeStream(stream1);
|
transport->closeStream(stream1);
|
||||||
|
|
||||||
EXPECT_CALL(readCb1, readError(stream1, IsError(LocalErrorCode::NO_ERROR)));
|
EXPECT_CALL(readCb1, readError(stream1, IsError(LocalErrorCode::NO_ERROR)));
|
||||||
|
EXPECT_CALL(connCallback, onStreamStateReaped(stream1));
|
||||||
transport->driveReadCallbacks();
|
transport->driveReadCallbacks();
|
||||||
|
|
||||||
EXPECT_FALSE(transport->transportConn->streamManager->streamExists(stream1));
|
EXPECT_FALSE(transport->transportConn->streamManager->streamExists(stream1));
|
||||||
|
Reference in New Issue
Block a user