mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-06 22:22:38 +03:00
Report exception strings via onConnectionError.
Summary: It's not a great practice to leak the excpetion string via a conn close, but it is useful for the app to be able to report what the exception string was. Reviewed By: yangchi Differential Revision: D20628591 fbshipit-source-id: bf6eb5f33f516cec0034caed53da998643fcc120
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d7da8247e8
commit
19e1c14afd
@@ -1030,6 +1030,30 @@ TEST_F(QuicTransportImplTest, ConnectionErrorOnWrite) {
|
||||
QuicErrorCode(LocalErrorCode::CONNECTION_ABANDONED));
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportImplTest, ConnectionErrorUnhandledException) {
|
||||
transport->transportConn->oneRttWriteCipher = test::createNoOpAead();
|
||||
auto stream = transport->createBidirectionalStream().value();
|
||||
EXPECT_CALL(
|
||||
connCallback,
|
||||
onConnectionError(std::make_pair(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::string("Well there's your problem"))));
|
||||
EXPECT_CALL(*socketPtr, write(_, _)).WillOnce(Invoke([](auto&, auto&) {
|
||||
throw std::runtime_error("Well there's your problem");
|
||||
return 0;
|
||||
}));
|
||||
QuicSocket::WriteResult result = transport->writeChain(
|
||||
stream, folly::IOBuf::copyBuffer("Hey"), true, false, nullptr);
|
||||
transport->addDataToStream(
|
||||
stream, StreamBuffer(folly::IOBuf::copyBuffer("Data"), 0));
|
||||
evb->loopOnce();
|
||||
|
||||
EXPECT_TRUE(transport->isClosed());
|
||||
EXPECT_EQ(
|
||||
transport->getConnectionError(),
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR));
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportImplTest, LossTimeoutNoLessThanTickInterval) {
|
||||
auto tickInterval = evb->timer().getTickInterval();
|
||||
transport->scheduleLossTimeout(tickInterval - 1ms);
|
||||
|
Reference in New Issue
Block a user