mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
error peek callbacks on connection closure
Summary: This was missed when peekError was added Reviewed By: mjoras, lnicco Differential Revision: D27973063 fbshipit-source-id: dbf1112a4ce6822401ba5125de853fe922acd85e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cf144da1d0
commit
5a0451760a
@@ -2603,7 +2603,13 @@ void QuicTransportBase::cancelAllAppCallbacks(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
VLOG(4) << "Clearing " << peekCallbacks_.size() << " peek callbacks";
|
VLOG(4) << "Clearing " << peekCallbacks_.size() << " peek callbacks";
|
||||||
peekCallbacks_.clear();
|
auto peekCallbacksCopy = peekCallbacks_;
|
||||||
|
for (auto& cb : peekCallbacksCopy) {
|
||||||
|
peekCallbacks_.erase(cb.first);
|
||||||
|
if (cb.second.peekCb) {
|
||||||
|
cb.second.peekCb->peekError(cb.first, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (connWriteCallback_) {
|
if (connWriteCallback_) {
|
||||||
auto connWriteCallback = connWriteCallback_;
|
auto connWriteCallback = connWriteCallback_;
|
||||||
|
@@ -2593,6 +2593,7 @@ TEST_F(QuicTransportImplTest, TestImmediateClose) {
|
|||||||
NiceMock<MockWriteCallback> wcb;
|
NiceMock<MockWriteCallback> wcb;
|
||||||
NiceMock<MockWriteCallback> wcbConn;
|
NiceMock<MockWriteCallback> wcbConn;
|
||||||
NiceMock<MockReadCallback> rcb;
|
NiceMock<MockReadCallback> rcb;
|
||||||
|
NiceMock<MockPeekCallback> pcb;
|
||||||
NiceMock<MockDeliveryCallback> deliveryCb;
|
NiceMock<MockDeliveryCallback> deliveryCb;
|
||||||
NiceMock<MockByteEventCallback> txCb;
|
NiceMock<MockByteEventCallback> txCb;
|
||||||
EXPECT_CALL(
|
EXPECT_CALL(
|
||||||
@@ -2604,6 +2605,8 @@ TEST_F(QuicTransportImplTest, TestImmediateClose) {
|
|||||||
onConnectionWriteError(IsAppError(GenericApplicationErrorCode::UNKNOWN)));
|
onConnectionWriteError(IsAppError(GenericApplicationErrorCode::UNKNOWN)));
|
||||||
EXPECT_CALL(
|
EXPECT_CALL(
|
||||||
rcb, readError(stream, IsAppError(GenericApplicationErrorCode::UNKNOWN)));
|
rcb, readError(stream, IsAppError(GenericApplicationErrorCode::UNKNOWN)));
|
||||||
|
EXPECT_CALL(
|
||||||
|
pcb, peekError(stream, IsAppError(GenericApplicationErrorCode::UNKNOWN)));
|
||||||
EXPECT_CALL(deliveryCb, onCanceled(stream, _));
|
EXPECT_CALL(deliveryCb, onCanceled(stream, _));
|
||||||
EXPECT_CALL(txCb, onByteEventCanceled(getTxMatcher(stream, 0)));
|
EXPECT_CALL(txCb, onByteEventCanceled(getTxMatcher(stream, 0)));
|
||||||
EXPECT_CALL(txCb, onByteEventCanceled(getTxMatcher(stream, 4)));
|
EXPECT_CALL(txCb, onByteEventCanceled(getTxMatcher(stream, 4)));
|
||||||
@@ -2613,6 +2616,7 @@ TEST_F(QuicTransportImplTest, TestImmediateClose) {
|
|||||||
transport->notifyPendingWriteOnConnection(&wcbConn);
|
transport->notifyPendingWriteOnConnection(&wcbConn);
|
||||||
transport->notifyPendingWriteOnStream(stream, &wcb);
|
transport->notifyPendingWriteOnStream(stream, &wcb);
|
||||||
transport->setReadCallback(stream, &rcb);
|
transport->setReadCallback(stream, &rcb);
|
||||||
|
transport->setPeekCallback(stream, &pcb);
|
||||||
EXPECT_CALL(*socketPtr, write(_, _))
|
EXPECT_CALL(*socketPtr, write(_, _))
|
||||||
.WillRepeatedly(SetErrnoAndReturn(EAGAIN, -1));
|
.WillRepeatedly(SetErrnoAndReturn(EAGAIN, -1));
|
||||||
transport->writeChain(stream, IOBuf::copyBuffer("hello"), true, &deliveryCb);
|
transport->writeChain(stream, IOBuf::copyBuffer("hello"), true, &deliveryCb);
|
||||||
@@ -2975,6 +2979,8 @@ TEST_F(QuicTransportImplTest, PeekError) {
|
|||||||
|
|
||||||
transport->driveReadCallbacks();
|
transport->driveReadCallbacks();
|
||||||
|
|
||||||
|
EXPECT_CALL(peekCb1, peekError(stream1, _));
|
||||||
|
|
||||||
transport.reset();
|
transport.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user