Have RST_STREAM & STOP_SENDING do expected closes for IETF QUIC (V99)
This change connects up the RST_STREAM and STOP_SENDING code so that
- when a RST_STREAM is sent, the sending node closes the stream for write only.
- when a RST_STREAM is received, the receiving node closes the stream for read only.
- when a STOP_SENDING is received, the node responds with a RST_STREAM and
closes the stream in the write direction (from the perspective of the node
receiving the STOP_SENDING)
Note that this implementation will send a RST_STREAM + STOP_SENDING, each causing the
stream to be closed in one direction. The two together cause the stream to be closed in
both directions, effecting a full close on the stream.
n/a, only for Version 99/IETF QUIC and controlled by the v99 flag
NO_BUG=Feature
Merge internal changes: 230929605, 233058905
[email protected]
Change-Id: I622dff1297efc90971f025e70c574dcb6f68bbe2
Reviewed-on: https://chromium-review.googlesource.com/c/1461077
Reviewed-by: Ryan Hamilton <[email protected]>
Commit-Queue: Frank Kastenholz <[email protected]>
Cr-Commit-Position: refs/heads/master@{#631814}
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc
index 056d0016..ab8e4bd9 100644
--- a/net/quic/quic_proxy_client_socket_unittest.cc
+++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -280,6 +280,20 @@
largest_received, smallest_received, least_unacked, kSendFeedback);
}
+ std::unique_ptr<quic::QuicReceivedPacket> ConstructAckAndRstOnlyPacket(
+ uint64_t packet_number,
+ quic::QuicRstStreamErrorCode error_code,
+ uint64_t largest_received,
+ uint64_t smallest_received,
+ uint64_t least_unacked,
+ size_t bytes_written) {
+ return client_maker_.MakeAckAndRstPacket(
+ packet_number, !kIncludeVersion, client_data_stream_id1_, error_code,
+ largest_received, smallest_received, least_unacked, kSendFeedback,
+ bytes_written,
+ /*include_stop_sending=*/false);
+ }
+
std::unique_ptr<quic::QuicReceivedPacket> ConstructAckAndRstPacket(
uint64_t packet_number,
quic::QuicRstStreamErrorCode error_code,
@@ -290,7 +304,8 @@
return client_maker_.MakeAckAndRstPacket(
packet_number, !kIncludeVersion, client_data_stream_id1_, error_code,
largest_received, smallest_received, least_unacked, kSendFeedback,
- bytes_written);
+ bytes_written,
+ /*include_stop_sending_if_v99=*/true);
}
std::unique_ptr<quic::QuicReceivedPacket> ConstructRstPacket(
@@ -299,7 +314,8 @@
size_t bytes_written) {
return client_maker_.MakeRstPacket(packet_number, !kIncludeVersion,
client_data_stream_id1_, error_code,
- bytes_written);
+ bytes_written,
+ /*include_stop_sending_if_v99=*/true);
}
std::unique_ptr<quic::QuicReceivedPacket> ConstructConnectRequestPacket(
@@ -386,7 +402,8 @@
size_t bytes_written) {
return server_maker_.MakeRstPacket(packet_number, !kIncludeVersion,
client_data_stream_id1_, error_code,
- bytes_written);
+ bytes_written,
+ /*include_stop_sending_if_v99=*/true);
}
std::unique_ptr<quic::QuicReceivedPacket> ConstructServerDataPacket(
@@ -1622,10 +1639,9 @@
mock_quic_data_.AddWrite(
ASYNC, ConstructAckAndMultipleDataFramesPacket(
3, 1, 1, 1, 0, {header, quic::QuicString(kMsg2, kLen2)}));
- mock_quic_data_.AddWrite(
- SYNCHRONOUS,
- ConstructAckAndRstPacket(4, quic::QUIC_RST_ACKNOWLEDGEMENT, 2, 2, 1,
- header.length() + kLen2));
+ mock_quic_data_.AddWrite(SYNCHRONOUS, ConstructAckAndRstOnlyPacket(
+ 4, quic::QUIC_STREAM_CANCELLED, 2,
+ 2, 1, header.length() + kLen2));
}
Initialize();
@@ -1757,10 +1773,9 @@
mock_quic_data_.AddWrite(
ASYNC, ConstructAckAndMultipleDataFramesPacket(
3, 1, 1, 1, 0, {header, quic::QuicString(kMsg1, kLen1)}));
- mock_quic_data_.AddWrite(
- SYNCHRONOUS,
- ConstructAckAndRstPacket(4, quic::QUIC_RST_ACKNOWLEDGEMENT, 2, 2, 1,
- header.length() + kLen1));
+ mock_quic_data_.AddWrite(SYNCHRONOUS, ConstructAckAndRstOnlyPacket(
+ 4, quic::QUIC_STREAM_CANCELLED, 2,
+ 2, 1, header.length() + kLen1));
}
Initialize();