mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Add number of streams to idle timeout error.
Summary: If we idle timeout when there are non control streams open, there could be some sort of issue especially with protocols like HTTP/3. Reviewed By: yangchi Differential Revision: D27017861 fbshipit-source-id: 319b839a641fa417a5026adf607c7bd0070cb66c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3128de512a
commit
386f6a840e
@@ -2351,10 +2351,14 @@ void QuicTransportBase::idleTimeoutExpired(bool drain) noexcept {
|
|||||||
// idle timeout is expired, just close the connection and drain or
|
// idle timeout is expired, just close the connection and drain or
|
||||||
// send connection close immediately depending on 'drain'
|
// send connection close immediately depending on 'drain'
|
||||||
DCHECK_NE(closeState_, CloseState::CLOSED);
|
DCHECK_NE(closeState_, CloseState::CLOSED);
|
||||||
|
uint64_t numOpenStreans = conn_->streamManager->streamCount();
|
||||||
closeImpl(
|
closeImpl(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
QuicErrorCode(LocalErrorCode::IDLE_TIMEOUT),
|
QuicErrorCode(LocalErrorCode::IDLE_TIMEOUT),
|
||||||
toString(LocalErrorCode::IDLE_TIMEOUT).str()),
|
folly::to<std::string>(
|
||||||
|
toString(LocalErrorCode::IDLE_TIMEOUT),
|
||||||
|
", num non control streams: ",
|
||||||
|
numOpenStreans - conn_->streamManager->numControlStreams())),
|
||||||
drain /* drainConnection */,
|
drain /* drainConnection */,
|
||||||
!drain /* sendCloseImmediately */);
|
!drain /* sendCloseImmediately */);
|
||||||
}
|
}
|
||||||
|
@@ -429,6 +429,32 @@ TEST_F(QuicTransportImplTest, IdleTimeoutExpiredDestroysTransport) {
|
|||||||
transport->invokeIdleTimeout();
|
transport->invokeIdleTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(QuicTransportImplTest, IdleTimeoutStreamMaessage) {
|
||||||
|
auto stream1 = transport->createBidirectionalStream().value();
|
||||||
|
auto stream2 = transport->createBidirectionalStream().value();
|
||||||
|
auto stream3 = transport->createUnidirectionalStream().value();
|
||||||
|
transport->setControlStream(stream3);
|
||||||
|
|
||||||
|
NiceMock<MockReadCallback> readCb1;
|
||||||
|
NiceMock<MockReadCallback> readCb2;
|
||||||
|
|
||||||
|
transport->setReadCallback(stream1, &readCb1);
|
||||||
|
transport->setReadCallback(stream2, &readCb2);
|
||||||
|
|
||||||
|
transport->addDataToStream(
|
||||||
|
stream1, StreamBuffer(folly::IOBuf::copyBuffer("actual stream data"), 0));
|
||||||
|
transport->addDataToStream(
|
||||||
|
stream2,
|
||||||
|
StreamBuffer(folly::IOBuf::copyBuffer("actual stream data"), 10));
|
||||||
|
EXPECT_CALL(readCb1, readError(stream1, _))
|
||||||
|
.Times(1)
|
||||||
|
.WillOnce(Invoke([](auto, auto error) {
|
||||||
|
EXPECT_EQ(
|
||||||
|
"Idle timeout, num non control streams: 2", error.second->str());
|
||||||
|
}));
|
||||||
|
transport->invokeIdleTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(QuicTransportImplTest, WriteAckPacketUnsetsLooper) {
|
TEST_F(QuicTransportImplTest, WriteAckPacketUnsetsLooper) {
|
||||||
// start looper in running state first
|
// start looper in running state first
|
||||||
transport->writeLooper()->run(true);
|
transport->writeLooper()->run(true);
|
||||||
|
@@ -725,6 +725,13 @@ class QuicStreamManager {
|
|||||||
return streams_.size() != numControlStreams_;
|
return streams_.size() != numControlStreams_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns number of control streams.
|
||||||
|
*/
|
||||||
|
auto numControlStreams() {
|
||||||
|
return numControlStreams_;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the given stream to be tracked as a control stream.
|
* Sets the given stream to be tracked as a control stream.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user