mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-07-29 03:41:11 +03:00
Modify QuicPacketScheduler for sending reliable resets
Summary: I'm modifying the `QuicPacketScheduler` so that we only send RESET_STREAM_AT frames when we've sent out all of the data upto the reliable offset. While this is not something that's mandated by the spec, it greatly simplifies the accounting of flow control if we do it this way. In more detail, if we allowed the egressing of the RESET_STREAM_AT frame before all of the reliable data was sent out, we'd need coordination between the StreamFrameScheduler and the RstStreamScheduler, so as to ensure that we are correctly accounting for flow control. In addition to that, we'd likely have to have a "flow control accounted for" offset in each stream state, so as to ensure that we don't "double count" flow control between the two schedulers. This adds significant complexity, so we're just sending RESET_STREAM_AT frames when we've sent out all of the data upto the reliable offset. Reviewed By: mjoras Differential Revision: D66709346 fbshipit-source-id: 01ca8659ae80fcdbd0e599f480fde10a11f0a56b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f391bdac57
commit
d40144ab03
@ -646,11 +646,21 @@ bool RstStreamScheduler::hasPendingRsts() const {
|
||||
bool RstStreamScheduler::writeRsts(PacketBuilderInterface& builder) {
|
||||
bool rstWritten = false;
|
||||
for (const auto& resetStream : conn_.pendingEvents.resets) {
|
||||
auto bytesWritten = writeFrame(resetStream.second, builder);
|
||||
if (!bytesWritten) {
|
||||
break;
|
||||
auto streamId = resetStream.first;
|
||||
QuicStreamState* streamState = conn_.streamManager->getStream(streamId);
|
||||
if (streamState->pendingWrites.empty() &&
|
||||
streamState->writeBufMeta.length == 0) {
|
||||
// We only write a RESET_STREAM or RESET_STREAM_AT frame for a stream
|
||||
// once we've written out all data that needs to be delivered reliably.
|
||||
// While this is not something that's mandated by the spec, we're doing
|
||||
// it in this implementation because it dramatically simplifies flow
|
||||
// control accounting.
|
||||
auto bytesWritten = writeFrame(resetStream.second, builder);
|
||||
if (!bytesWritten) {
|
||||
break;
|
||||
}
|
||||
rstWritten = true;
|
||||
}
|
||||
rstWritten = true;
|
||||
}
|
||||
return rstWritten;
|
||||
}
|
||||
|
Reference in New Issue
Block a user