OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/core/quic_connection.h" | 5 #include "net/quic/core/quic_connection.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <utility> | 10 #include <utility> |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "net/test/gtest_util.h" | 39 #include "net/test/gtest_util.h" |
40 #include "testing/gmock_mutant.h" | 40 #include "testing/gmock_mutant.h" |
41 | 41 |
42 using std::string; | 42 using std::string; |
43 using testing::AnyNumber; | 43 using testing::AnyNumber; |
44 using testing::AtLeast; | 44 using testing::AtLeast; |
45 using testing::DoAll; | 45 using testing::DoAll; |
46 using testing::InSequence; | 46 using testing::InSequence; |
47 using testing::Invoke; | 47 using testing::Invoke; |
48 using testing::InvokeWithoutArgs; | 48 using testing::InvokeWithoutArgs; |
49 using testing::NiceMock; | |
50 using testing::Ref; | 49 using testing::Ref; |
51 using testing::Return; | 50 using testing::Return; |
52 using testing::SaveArg; | 51 using testing::SaveArg; |
53 using testing::SetArgPointee; | 52 using testing::SetArgPointee; |
54 using testing::StrictMock; | 53 using testing::StrictMock; |
55 using testing::_; | 54 using testing::_; |
56 | 55 |
57 namespace net { | 56 namespace net { |
58 namespace test { | 57 namespace test { |
59 namespace { | 58 namespace { |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 return frame; | 1001 return frame; |
1003 } | 1002 } |
1004 | 1003 |
1005 const QuicStopWaitingFrame InitStopWaitingFrame( | 1004 const QuicStopWaitingFrame InitStopWaitingFrame( |
1006 QuicPacketNumber least_unacked) { | 1005 QuicPacketNumber least_unacked) { |
1007 QuicStopWaitingFrame frame; | 1006 QuicStopWaitingFrame frame; |
1008 frame.least_unacked = least_unacked; | 1007 frame.least_unacked = least_unacked; |
1009 return frame; | 1008 return frame; |
1010 } | 1009 } |
1011 | 1010 |
1012 // Explicitly nack a packet. | 1011 // Construct ack_frame containing up to two ranges |
1013 void NackPacket(QuicPacketNumber missing, QuicAckFrame* frame) { | 1012 // [1, missing) and (missing, end_range] |
1014 frame->packets.RemoveTestOnly(missing); | 1013 QuicAckFrame ConstructAckFrame(QuicPacketNumber largest_acked, |
| 1014 QuicPacketNumber missing) { |
| 1015 QuicAckFrame ack_frame; |
| 1016 if (largest_acked > missing) { |
| 1017 ack_frame.packets.Add(1, missing); |
| 1018 ack_frame.packets.Add(missing + 1, largest_acked + 1); |
| 1019 ack_frame.largest_observed = largest_acked; |
| 1020 } |
| 1021 if (largest_acked == missing) { |
| 1022 ack_frame.packets.Add(1, missing); |
| 1023 ack_frame.largest_observed = largest_acked; |
| 1024 } |
| 1025 return ack_frame; |
1015 } | 1026 } |
1016 | 1027 |
1017 // Undo nacking a packet within the frame. | 1028 // Undo nacking a packet within the frame. |
1018 void AckPacket(QuicPacketNumber arrived, QuicAckFrame* frame) { | 1029 void AckPacket(QuicPacketNumber arrived, QuicAckFrame* frame) { |
1019 EXPECT_FALSE(frame->packets.Contains(arrived)); | 1030 EXPECT_FALSE(frame->packets.Contains(arrived)); |
1020 frame->packets.Add(arrived); | 1031 frame->packets.Add(arrived); |
1021 } | 1032 } |
1022 | 1033 |
1023 void TriggerConnectionClose() { | 1034 void TriggerConnectionClose() { |
1024 // Send an erroneous packet to close the connection. | 1035 // Send an erroneous packet to close the connection. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 } | 1451 } |
1441 | 1452 |
1442 TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) { | 1453 TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) { |
1443 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1454 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1444 QuicPacketNumber original; | 1455 QuicPacketNumber original; |
1445 QuicByteCount packet_size; | 1456 QuicByteCount packet_size; |
1446 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 1457 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
1447 .WillOnce( | 1458 .WillOnce( |
1448 DoAll(SaveArg<2>(&original), SaveArg<3>(&packet_size), Return(true))); | 1459 DoAll(SaveArg<2>(&original), SaveArg<3>(&packet_size), Return(true))); |
1449 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); | 1460 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); |
1450 QuicAckFrame frame = InitAckFrame(original); | 1461 QuicAckFrame frame = ConstructAckFrame(original, original); |
1451 NackPacket(original, &frame); | |
1452 // First nack triggers early retransmit. | 1462 // First nack triggers early retransmit. |
1453 SendAlgorithmInterface::CongestionVector lost_packets; | 1463 SendAlgorithmInterface::CongestionVector lost_packets; |
1454 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); | 1464 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
1455 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 1465 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
1456 .WillOnce(SetArgPointee<4>(lost_packets)); | 1466 .WillOnce(SetArgPointee<4>(lost_packets)); |
1457 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 1467 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
1458 QuicPacketNumber retransmission; | 1468 QuicPacketNumber retransmission; |
1459 EXPECT_CALL(*send_algorithm_, | 1469 EXPECT_CALL(*send_algorithm_, |
1460 OnPacketSent(_, _, _, packet_size - kQuicVersionSize, _)) | 1470 OnPacketSent(_, _, _, packet_size - kQuicVersionSize, _)) |
1461 .WillOnce(DoAll(SaveArg<2>(&retransmission), Return(true))); | 1471 .WillOnce(DoAll(SaveArg<2>(&retransmission), Return(true))); |
1462 | 1472 |
1463 ProcessAckPacket(&frame); | 1473 ProcessAckPacket(&frame); |
1464 | 1474 |
1465 QuicAckFrame frame2 = InitAckFrame(retransmission); | 1475 QuicAckFrame frame2 = ConstructAckFrame(retransmission, original); |
1466 NackPacket(original, &frame2); | |
1467 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 1476 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
1468 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); | 1477 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); |
1469 ProcessAckPacket(&frame2); | 1478 ProcessAckPacket(&frame2); |
1470 | 1479 |
1471 // Now if the peer sends an ack which still reports the retransmitted packet | 1480 // Now if the peer sends an ack which still reports the retransmitted packet |
1472 // as missing, that will bundle an ack with data after two acks in a row | 1481 // as missing, that will bundle an ack with data after two acks in a row |
1473 // indicate the high water mark needs to be raised. | 1482 // indicate the high water mark needs to be raised. |
1474 EXPECT_CALL(*send_algorithm_, | 1483 EXPECT_CALL(*send_algorithm_, |
1475 OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)); | 1484 OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)); |
1476 connection_.SendStreamDataWithString(3, "foo", 3, NO_FIN, nullptr); | 1485 connection_.SendStreamDataWithString(3, "foo", 3, NO_FIN, nullptr); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 | 1618 |
1610 const int num_packets = kMaxTrackedPackets + 100; | 1619 const int num_packets = kMaxTrackedPackets + 100; |
1611 for (int i = 0; i < num_packets; ++i) { | 1620 for (int i = 0; i < num_packets; ++i) { |
1612 SendStreamDataToPeer(1, "foo", 3 * i, NO_FIN, nullptr); | 1621 SendStreamDataToPeer(1, "foo", 3 * i, NO_FIN, nullptr); |
1613 } | 1622 } |
1614 | 1623 |
1615 // Ack packet 1, which leaves more than the limit outstanding. | 1624 // Ack packet 1, which leaves more than the limit outstanding. |
1616 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 1625 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
1617 | 1626 |
1618 // Nack the first packet and ack the rest, leaving a huge gap. | 1627 // Nack the first packet and ack the rest, leaving a huge gap. |
1619 QuicAckFrame frame1 = InitAckFrame(num_packets); | 1628 QuicAckFrame frame1 = ConstructAckFrame(num_packets, 1); |
1620 NackPacket(1, &frame1); | |
1621 ProcessAckPacket(&frame1); | 1629 ProcessAckPacket(&frame1); |
1622 } | 1630 } |
1623 | 1631 |
1624 TEST_P(QuicConnectionTest, TooManyReceivedPackets) { | 1632 TEST_P(QuicConnectionTest, TooManyReceivedPackets) { |
1625 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1633 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1626 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber()); | 1634 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber()); |
1627 // Miss 99 of every 100 packets for 5500 packets. | 1635 // Miss 99 of every 100 packets for 5500 packets. |
1628 for (QuicPacketNumber i = 1; i < kMaxTrackedPackets + 500; i += 100) { | 1636 for (QuicPacketNumber i = 1; i < kMaxTrackedPackets + 500; i += 100) { |
1629 ProcessPacket(i); | 1637 ProcessPacket(i); |
1630 if (!connection_.connected()) { | 1638 if (!connection_.connected()) { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 SendStreamDataToPeer(3, "fooos", 7, NO_FIN, &last_packet); // Packet 3 | 2045 SendStreamDataToPeer(3, "fooos", 7, NO_FIN, &last_packet); // Packet 3 |
2038 | 2046 |
2039 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2047 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2040 | 2048 |
2041 // Don't lose a packet on an ack, and nothing is retransmitted. | 2049 // Don't lose a packet on an ack, and nothing is retransmitted. |
2042 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2050 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2043 QuicAckFrame ack_one = InitAckFrame(1); | 2051 QuicAckFrame ack_one = InitAckFrame(1); |
2044 ProcessAckPacket(&ack_one); | 2052 ProcessAckPacket(&ack_one); |
2045 | 2053 |
2046 // Lose a packet and ensure it triggers retransmission. | 2054 // Lose a packet and ensure it triggers retransmission. |
2047 QuicAckFrame nack_two = InitAckFrame(3); | 2055 QuicAckFrame nack_two = ConstructAckFrame(3, 2); |
2048 NackPacket(2, &nack_two); | |
2049 SendAlgorithmInterface::CongestionVector lost_packets; | 2056 SendAlgorithmInterface::CongestionVector lost_packets; |
2050 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); | 2057 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
2051 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 2058 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
2052 .WillOnce(SetArgPointee<4>(lost_packets)); | 2059 .WillOnce(SetArgPointee<4>(lost_packets)); |
2053 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2060 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2054 EXPECT_CALL(*send_algorithm_, | 2061 EXPECT_CALL(*send_algorithm_, |
2055 OnPacketSent(_, _, _, second_packet_size - kQuicVersionSize, _)) | 2062 OnPacketSent(_, _, _, second_packet_size - kQuicVersionSize, _)) |
2056 .Times(1); | 2063 .Times(1); |
2057 ProcessAckPacket(&nack_two); | 2064 ProcessAckPacket(&nack_two); |
2058 } | 2065 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 QuicStreamId stream_id = 2; | 2105 QuicStreamId stream_id = 2; |
2099 QuicPacketNumber last_packet; | 2106 QuicPacketNumber last_packet; |
2100 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); | 2107 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); |
2101 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); | 2108 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); |
2102 SendStreamDataToPeer(stream_id, "fooos", 7, NO_FIN, &last_packet); | 2109 SendStreamDataToPeer(stream_id, "fooos", 7, NO_FIN, &last_packet); |
2103 | 2110 |
2104 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); | 2111 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
2105 connection_.SendRstStream(stream_id, QUIC_ERROR_PROCESSING_STREAM, 14); | 2112 connection_.SendRstStream(stream_id, QUIC_ERROR_PROCESSING_STREAM, 14); |
2106 | 2113 |
2107 // Lose a packet and ensure it does not trigger retransmission. | 2114 // Lose a packet and ensure it does not trigger retransmission. |
2108 QuicAckFrame nack_two = InitAckFrame(last_packet); | 2115 QuicAckFrame nack_two = ConstructAckFrame(last_packet, last_packet - 1); |
2109 NackPacket(last_packet - 1, &nack_two); | |
2110 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2116 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2111 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); | 2117 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); |
2112 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2118 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2113 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); | 2119 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
2114 ProcessAckPacket(&nack_two); | 2120 ProcessAckPacket(&nack_two); |
2115 } | 2121 } |
2116 | 2122 |
2117 TEST_P(QuicConnectionTest, RetransmitForQuicRstStreamNoErrorOnNack) { | 2123 TEST_P(QuicConnectionTest, RetransmitForQuicRstStreamNoErrorOnNack) { |
2118 QuicStreamId stream_id = 2; | 2124 QuicStreamId stream_id = 2; |
2119 QuicPacketNumber last_packet; | 2125 QuicPacketNumber last_packet; |
2120 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); | 2126 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); |
2121 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); | 2127 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); |
2122 SendStreamDataToPeer(stream_id, "fooos", 7, NO_FIN, &last_packet); | 2128 SendStreamDataToPeer(stream_id, "fooos", 7, NO_FIN, &last_packet); |
2123 | 2129 |
2124 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); | 2130 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
2125 connection_.SendRstStream(stream_id, QUIC_STREAM_NO_ERROR, 14); | 2131 connection_.SendRstStream(stream_id, QUIC_STREAM_NO_ERROR, 14); |
2126 | 2132 |
2127 // Lose a packet, ensure it triggers retransmission. | 2133 // Lose a packet, ensure it triggers retransmission. |
2128 QuicAckFrame nack_two = InitAckFrame(last_packet); | 2134 QuicAckFrame nack_two = ConstructAckFrame(last_packet, last_packet - 1); |
2129 NackPacket(last_packet - 1, &nack_two); | |
2130 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2135 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2131 SendAlgorithmInterface::CongestionVector lost_packets; | 2136 SendAlgorithmInterface::CongestionVector lost_packets; |
2132 lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); | 2137 lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); |
2133 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 2138 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
2134 .WillOnce(SetArgPointee<4>(lost_packets)); | 2139 .WillOnce(SetArgPointee<4>(lost_packets)); |
2135 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2140 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2136 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1)); | 2141 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1)); |
2137 ProcessAckPacket(&nack_two); | 2142 ProcessAckPacket(&nack_two); |
2138 } | 2143 } |
2139 | 2144 |
(...skipping 21 matching lines...) Expand all Loading... |
2161 QuicPacketNumber last_data_packet; | 2166 QuicPacketNumber last_data_packet; |
2162 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_data_packet); | 2167 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_data_packet); |
2163 | 2168 |
2164 // Cancel the stream. | 2169 // Cancel the stream. |
2165 const QuicPacketNumber rst_packet = last_data_packet + 1; | 2170 const QuicPacketNumber rst_packet = last_data_packet + 1; |
2166 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, rst_packet, _, _)).Times(1); | 2171 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, rst_packet, _, _)).Times(1); |
2167 connection_.SendRstStream(stream_id, QUIC_ERROR_PROCESSING_STREAM, 14); | 2172 connection_.SendRstStream(stream_id, QUIC_ERROR_PROCESSING_STREAM, 14); |
2168 | 2173 |
2169 // Ack the RST_STREAM frame (since it's retransmittable), but not the data | 2174 // Ack the RST_STREAM frame (since it's retransmittable), but not the data |
2170 // packet, which is no longer retransmittable since the stream was cancelled. | 2175 // packet, which is no longer retransmittable since the stream was cancelled. |
2171 QuicAckFrame nack_stream_data = InitAckFrame(rst_packet); | 2176 QuicAckFrame nack_stream_data = |
2172 NackPacket(last_data_packet, &nack_stream_data); | 2177 ConstructAckFrame(rst_packet, last_data_packet); |
2173 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2178 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2174 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2179 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2175 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); | 2180 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
2176 ProcessAckPacket(&nack_stream_data); | 2181 ProcessAckPacket(&nack_stream_data); |
2177 | 2182 |
2178 // Ensure that the data is still in flight, but the retransmission alarm is no | 2183 // Ensure that the data is still in flight, but the retransmission alarm is no |
2179 // longer set. | 2184 // longer set. |
2180 EXPECT_GT(QuicSentPacketManagerPeer::GetBytesInFlight(manager_), 0u); | 2185 EXPECT_GT(QuicSentPacketManagerPeer::GetBytesInFlight(manager_), 0u); |
2181 EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet()); | 2186 EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet()); |
2182 } | 2187 } |
(...skipping 20 matching lines...) Expand all Loading... |
2203 | 2208 |
2204 TEST_P(QuicConnectionTest, DoNotSendPendingRetransmissionForResetStream) { | 2209 TEST_P(QuicConnectionTest, DoNotSendPendingRetransmissionForResetStream) { |
2205 QuicStreamId stream_id = 2; | 2210 QuicStreamId stream_id = 2; |
2206 QuicPacketNumber last_packet; | 2211 QuicPacketNumber last_packet; |
2207 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); | 2212 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); |
2208 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); | 2213 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); |
2209 BlockOnNextWrite(); | 2214 BlockOnNextWrite(); |
2210 connection_.SendStreamDataWithString(stream_id, "fooos", 7, NO_FIN, nullptr); | 2215 connection_.SendStreamDataWithString(stream_id, "fooos", 7, NO_FIN, nullptr); |
2211 | 2216 |
2212 // Lose a packet which will trigger a pending retransmission. | 2217 // Lose a packet which will trigger a pending retransmission. |
2213 QuicAckFrame ack = InitAckFrame(last_packet); | 2218 QuicAckFrame ack = ConstructAckFrame(last_packet, last_packet - 1); |
2214 NackPacket(last_packet - 1, &ack); | |
2215 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2219 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2216 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); | 2220 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); |
2217 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2221 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2218 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); | 2222 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
2219 ProcessAckPacket(&ack); | 2223 ProcessAckPacket(&ack); |
2220 | 2224 |
2221 connection_.SendRstStream(stream_id, QUIC_ERROR_PROCESSING_STREAM, 14); | 2225 connection_.SendRstStream(stream_id, QUIC_ERROR_PROCESSING_STREAM, 14); |
2222 | 2226 |
2223 // Unblock the connection and verify that the RST_STREAM is sent but not the | 2227 // Unblock the connection and verify that the RST_STREAM is sent but not the |
2224 // second data packet nor a retransmit. | 2228 // second data packet nor a retransmit. |
2225 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); | 2229 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
2226 writer_->SetWritable(); | 2230 writer_->SetWritable(); |
2227 connection_.OnCanWrite(); | 2231 connection_.OnCanWrite(); |
2228 EXPECT_EQ(1u, writer_->frame_count()); | 2232 EXPECT_EQ(1u, writer_->frame_count()); |
2229 EXPECT_EQ(1u, writer_->rst_stream_frames().size()); | 2233 EXPECT_EQ(1u, writer_->rst_stream_frames().size()); |
2230 EXPECT_EQ(stream_id, writer_->rst_stream_frames().front().stream_id); | 2234 EXPECT_EQ(stream_id, writer_->rst_stream_frames().front().stream_id); |
2231 } | 2235 } |
2232 | 2236 |
2233 TEST_P(QuicConnectionTest, SendPendingRetransmissionForQuicRstStreamNoError) { | 2237 TEST_P(QuicConnectionTest, SendPendingRetransmissionForQuicRstStreamNoError) { |
2234 QuicStreamId stream_id = 2; | 2238 QuicStreamId stream_id = 2; |
2235 QuicPacketNumber last_packet; | 2239 QuicPacketNumber last_packet; |
2236 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); | 2240 SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet); |
2237 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); | 2241 SendStreamDataToPeer(stream_id, "foos", 3, NO_FIN, &last_packet); |
2238 BlockOnNextWrite(); | 2242 BlockOnNextWrite(); |
2239 connection_.SendStreamDataWithString(stream_id, "fooos", 7, NO_FIN, nullptr); | 2243 connection_.SendStreamDataWithString(stream_id, "fooos", 7, NO_FIN, nullptr); |
2240 | 2244 |
2241 // Lose a packet which will trigger a pending retransmission. | 2245 // Lose a packet which will trigger a pending retransmission. |
2242 QuicAckFrame ack = InitAckFrame(last_packet); | 2246 QuicAckFrame ack = ConstructAckFrame(last_packet, last_packet - 1); |
2243 NackPacket(last_packet - 1, &ack); | |
2244 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2247 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2245 SendAlgorithmInterface::CongestionVector lost_packets; | 2248 SendAlgorithmInterface::CongestionVector lost_packets; |
2246 lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); | 2249 lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); |
2247 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 2250 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
2248 .WillOnce(SetArgPointee<4>(lost_packets)); | 2251 .WillOnce(SetArgPointee<4>(lost_packets)); |
2249 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2252 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2250 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); | 2253 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
2251 ProcessAckPacket(&ack); | 2254 ProcessAckPacket(&ack); |
2252 | 2255 |
2253 connection_.SendRstStream(stream_id, QUIC_STREAM_NO_ERROR, 14); | 2256 connection_.SendRstStream(stream_id, QUIC_STREAM_NO_ERROR, 14); |
2254 | 2257 |
2255 // Unblock the connection and verify that the RST_STREAM is sent and the | 2258 // Unblock the connection and verify that the RST_STREAM is sent and the |
2256 // second data packet or a retransmit is sent. | 2259 // second data packet or a retransmit is sent. |
2257 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(2)); | 2260 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(2)); |
2258 writer_->SetWritable(); | 2261 writer_->SetWritable(); |
2259 connection_.OnCanWrite(); | 2262 connection_.OnCanWrite(); |
2260 EXPECT_EQ(1u, writer_->frame_count()); | 2263 EXPECT_EQ(1u, writer_->frame_count()); |
2261 EXPECT_EQ(0u, writer_->rst_stream_frames().size()); | 2264 EXPECT_EQ(0u, writer_->rst_stream_frames().size()); |
2262 } | 2265 } |
2263 | 2266 |
2264 TEST_P(QuicConnectionTest, RetransmitAckedPacket) { | 2267 TEST_P(QuicConnectionTest, RetransmitAckedPacket) { |
2265 QuicPacketNumber last_packet; | 2268 QuicPacketNumber last_packet; |
2266 SendStreamDataToPeer(1, "foo", 0, NO_FIN, &last_packet); // Packet 1 | 2269 SendStreamDataToPeer(1, "foo", 0, NO_FIN, &last_packet); // Packet 1 |
2267 SendStreamDataToPeer(1, "foos", 3, NO_FIN, &last_packet); // Packet 2 | 2270 SendStreamDataToPeer(1, "foos", 3, NO_FIN, &last_packet); // Packet 2 |
2268 SendStreamDataToPeer(1, "fooos", 7, NO_FIN, &last_packet); // Packet 3 | 2271 SendStreamDataToPeer(1, "fooos", 7, NO_FIN, &last_packet); // Packet 3 |
2269 | 2272 |
2270 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2273 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2271 | 2274 |
2272 // Instigate a loss with an ack. | 2275 // Instigate a loss with an ack. |
2273 QuicAckFrame nack_two = InitAckFrame(3); | 2276 QuicAckFrame nack_two = ConstructAckFrame(3, 2); |
2274 NackPacket(2, &nack_two); | |
2275 // The first nack should trigger a fast retransmission, but we'll be | 2277 // The first nack should trigger a fast retransmission, but we'll be |
2276 // write blocked, so the packet will be queued. | 2278 // write blocked, so the packet will be queued. |
2277 BlockOnNextWrite(); | 2279 BlockOnNextWrite(); |
2278 | 2280 |
2279 SendAlgorithmInterface::CongestionVector lost_packets; | 2281 SendAlgorithmInterface::CongestionVector lost_packets; |
2280 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); | 2282 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
2281 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 2283 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
2282 .WillOnce(SetArgPointee<4>(lost_packets)); | 2284 .WillOnce(SetArgPointee<4>(lost_packets)); |
2283 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2285 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2284 ProcessAckPacket(&nack_two); | 2286 ProcessAckPacket(&nack_two); |
(...skipping 18 matching lines...) Expand all Loading... |
2303 | 2305 |
2304 TEST_P(QuicConnectionTest, RetransmitNackedLargestObserved) { | 2306 TEST_P(QuicConnectionTest, RetransmitNackedLargestObserved) { |
2305 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2307 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2306 QuicPacketNumber largest_observed; | 2308 QuicPacketNumber largest_observed; |
2307 QuicByteCount packet_size; | 2309 QuicByteCount packet_size; |
2308 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 2310 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
2309 .WillOnce(DoAll(SaveArg<2>(&largest_observed), SaveArg<3>(&packet_size), | 2311 .WillOnce(DoAll(SaveArg<2>(&largest_observed), SaveArg<3>(&packet_size), |
2310 Return(true))); | 2312 Return(true))); |
2311 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); | 2313 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); |
2312 | 2314 |
2313 QuicAckFrame frame = InitAckFrame(1); | 2315 QuicAckFrame frame = ConstructAckFrame(1, largest_observed); |
2314 NackPacket(largest_observed, &frame); | |
2315 // The first nack should retransmit the largest observed packet. | 2316 // The first nack should retransmit the largest observed packet. |
2316 SendAlgorithmInterface::CongestionVector lost_packets; | 2317 SendAlgorithmInterface::CongestionVector lost_packets; |
2317 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); | 2318 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
2318 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 2319 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
2319 .WillOnce(SetArgPointee<4>(lost_packets)); | 2320 .WillOnce(SetArgPointee<4>(lost_packets)); |
2320 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2321 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2321 EXPECT_CALL(*send_algorithm_, | 2322 EXPECT_CALL(*send_algorithm_, |
2322 OnPacketSent(_, _, _, packet_size - kQuicVersionSize, _)); | 2323 OnPacketSent(_, _, _, packet_size - kQuicVersionSize, _)); |
2323 ProcessAckPacket(&frame); | 2324 ProcessAckPacket(&frame); |
2324 } | 2325 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2426 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2426 int offset = 0; | 2427 int offset = 0; |
2427 // Send packets 1 to 15. | 2428 // Send packets 1 to 15. |
2428 for (int i = 0; i < 15; ++i) { | 2429 for (int i = 0; i < 15; ++i) { |
2429 SendStreamDataToPeer(1, "foo", offset, NO_FIN, nullptr); | 2430 SendStreamDataToPeer(1, "foo", offset, NO_FIN, nullptr); |
2430 offset += 3; | 2431 offset += 3; |
2431 } | 2432 } |
2432 | 2433 |
2433 // Ack 15, nack 1-14. | 2434 // Ack 15, nack 1-14. |
2434 | 2435 |
2435 QuicAckFrame nack = InitAckFrame(15); | 2436 QuicAckFrame nack; |
2436 for (int i = 1; i < 15; ++i) { | 2437 nack.packets.Add(15); |
2437 NackPacket(i, &nack); | 2438 nack.largest_observed = 15; |
2438 } | |
2439 | 2439 |
2440 // 14 packets have been NACK'd and lost. | 2440 // 14 packets have been NACK'd and lost. |
2441 SendAlgorithmInterface::CongestionVector lost_packets; | 2441 SendAlgorithmInterface::CongestionVector lost_packets; |
2442 for (int i = 1; i < 15; ++i) { | 2442 for (int i = 1; i < 15; ++i) { |
2443 lost_packets.push_back(std::make_pair(i, kMaxPacketSize)); | 2443 lost_packets.push_back(std::make_pair(i, kMaxPacketSize)); |
2444 } | 2444 } |
2445 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 2445 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
2446 .WillOnce(SetArgPointee<4>(lost_packets)); | 2446 .WillOnce(SetArgPointee<4>(lost_packets)); |
2447 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2447 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2448 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(14); | 2448 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(14); |
(...skipping 10 matching lines...) Expand all Loading... |
2459 SendAckPacketToPeer(); // Packet 3 | 2459 SendAckPacketToPeer(); // Packet 3 |
2460 SendStreamDataToPeer(5, "foo", 0, NO_FIN, &last_packet); // Packet 4 | 2460 SendStreamDataToPeer(5, "foo", 0, NO_FIN, &last_packet); // Packet 4 |
2461 EXPECT_EQ(4u, last_packet); | 2461 EXPECT_EQ(4u, last_packet); |
2462 SendStreamDataToPeer(1, "foo", 3, NO_FIN, &last_packet); // Packet 5 | 2462 SendStreamDataToPeer(1, "foo", 3, NO_FIN, &last_packet); // Packet 5 |
2463 EXPECT_EQ(5u, last_packet); | 2463 EXPECT_EQ(5u, last_packet); |
2464 SendStreamDataToPeer(3, "foo", 3, NO_FIN, &last_packet); // Packet 6 | 2464 SendStreamDataToPeer(3, "foo", 3, NO_FIN, &last_packet); // Packet 6 |
2465 EXPECT_EQ(6u, last_packet); | 2465 EXPECT_EQ(6u, last_packet); |
2466 | 2466 |
2467 // Client will ack packets 1, 2, [!3], 4, 5. | 2467 // Client will ack packets 1, 2, [!3], 4, 5. |
2468 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2468 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2469 QuicAckFrame frame1 = InitAckFrame(5); | 2469 QuicAckFrame frame1 = ConstructAckFrame(5, 3); |
2470 NackPacket(3, &frame1); | |
2471 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2470 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2472 ProcessAckPacket(&frame1); | 2471 ProcessAckPacket(&frame1); |
2473 | 2472 |
2474 // Now the client implicitly acks 3, and explicitly acks 6. | 2473 // Now the client implicitly acks 3, and explicitly acks 6. |
2475 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2474 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2476 QuicAckFrame frame2 = InitAckFrame(6); | 2475 QuicAckFrame frame2 = InitAckFrame(6); |
2477 ProcessAckPacket(&frame2); | 2476 ProcessAckPacket(&frame2); |
2478 } | 2477 } |
2479 | 2478 |
2480 TEST_P(QuicConnectionTest, DontLatchUnackedPacket) { | 2479 TEST_P(QuicConnectionTest, DontLatchUnackedPacket) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 } | 2532 } |
2534 | 2533 |
2535 // Send two data packets at the end, and ensure if the last one is acked, | 2534 // Send two data packets at the end, and ensure if the last one is acked, |
2536 // the least unacked is raised above the ack packets. | 2535 // the least unacked is raised above the ack packets. |
2537 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 2536 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
2538 .WillByDefault(Return(true)); | 2537 .WillByDefault(Return(true)); |
2539 SendStreamDataToPeer(1, "bar", 6, NO_FIN, nullptr); // Packet 6 | 2538 SendStreamDataToPeer(1, "bar", 6, NO_FIN, nullptr); // Packet 6 |
2540 SendStreamDataToPeer(1, "bar", 9, NO_FIN, nullptr); // Packet 7 | 2539 SendStreamDataToPeer(1, "bar", 9, NO_FIN, nullptr); // Packet 7 |
2541 | 2540 |
2542 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 2541 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
2543 frame = InitAckFrame(7); | 2542 frame = InitAckFrame(4); |
2544 NackPacket(5, &frame); | 2543 frame.packets.Add(7); |
2545 NackPacket(6, &frame); | 2544 frame.largest_observed = 7; |
2546 ProcessAckPacket(&frame); | 2545 ProcessAckPacket(&frame); |
2547 | 2546 |
2548 EXPECT_EQ(6u, stop_waiting()->least_unacked); | 2547 EXPECT_EQ(6u, stop_waiting()->least_unacked); |
2549 } | 2548 } |
2550 | 2549 |
2551 TEST_P(QuicConnectionTest, TLP) { | 2550 TEST_P(QuicConnectionTest, TLP) { |
2552 connection_.SetMaxTailLossProbes(1); | 2551 connection_.SetMaxTailLossProbes(1); |
2553 | 2552 |
2554 SendStreamDataToPeer(3, "foo", 0, NO_FIN, nullptr); | 2553 SendStreamDataToPeer(3, "foo", 0, NO_FIN, nullptr); |
2555 EXPECT_EQ(1u, stop_waiting()->least_unacked); | 2554 EXPECT_EQ(1u, stop_waiting()->least_unacked); |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3135 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3137 // Called on many acks. | 3136 // Called on many acks. |
3138 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)) | 3137 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)) |
3139 .Times(AnyNumber()); | 3138 .Times(AnyNumber()); |
3140 for (QuicPacketCount i = 0; i < number_of_packets; i++) { | 3139 for (QuicPacketCount i = 0; i < number_of_packets; i++) { |
3141 SendStreamDataToPeer(3, "!", i, NO_FIN, nullptr); | 3140 SendStreamDataToPeer(3, "!", i, NO_FIN, nullptr); |
3142 clock_.AdvanceTime(rtt); | 3141 clock_.AdvanceTime(rtt); |
3143 | 3142 |
3144 // Receive an ACK, which marks all data packets as received, and all MTU | 3143 // Receive an ACK, which marks all data packets as received, and all MTU |
3145 // discovery packets as missing. | 3144 // discovery packets as missing. |
3146 QuicAckFrame ack = InitAckFrame(creator_->packet_number()); | 3145 |
3147 for (QuicPacketNumber& packet : mtu_discovery_packets) { | 3146 QuicAckFrame ack; |
3148 NackPacket(packet, &ack); | 3147 |
| 3148 if (!mtu_discovery_packets.empty()) { |
| 3149 QuicPacketNumber min_packet = *min_element(mtu_discovery_packets.begin(), |
| 3150 mtu_discovery_packets.end()); |
| 3151 QuicPacketNumber max_packet = *max_element(mtu_discovery_packets.begin(), |
| 3152 mtu_discovery_packets.end()); |
| 3153 ack.packets.Add(1, min_packet); |
| 3154 ack.packets.Add(max_packet + 1, creator_->packet_number() + 1); |
| 3155 ack.largest_observed = creator_->packet_number(); |
| 3156 |
| 3157 } else { |
| 3158 ack.packets.Add(1, creator_->packet_number() + 1); |
| 3159 ack.largest_observed = creator_->packet_number(); |
3149 } | 3160 } |
| 3161 |
3150 ProcessAckPacket(&ack); | 3162 ProcessAckPacket(&ack); |
3151 | 3163 |
3152 // Trigger MTU probe if it would be scheduled now. | 3164 // Trigger MTU probe if it would be scheduled now. |
3153 if (!connection_.GetMtuDiscoveryAlarm()->IsSet()) { | 3165 if (!connection_.GetMtuDiscoveryAlarm()->IsSet()) { |
3154 continue; | 3166 continue; |
3155 } | 3167 } |
3156 | 3168 |
3157 // Fire the alarm. The alarm should cause a packet to be sent. | 3169 // Fire the alarm. The alarm should cause a packet to be sent. |
3158 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 3170 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
3159 .WillOnce(Return(true)); | 3171 .WillOnce(Return(true)); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3249 | 3261 |
3250 // Send more data. | 3262 // Send more data. |
3251 QuicPacketNumber probe_number = creator_->packet_number(); | 3263 QuicPacketNumber probe_number = creator_->packet_number(); |
3252 QuicPacketCount extra_packets = kPacketsBetweenMtuProbesBase * 3; | 3264 QuicPacketCount extra_packets = kPacketsBetweenMtuProbesBase * 3; |
3253 for (QuicPacketCount i = 0; i < extra_packets; i++) { | 3265 for (QuicPacketCount i = 0; i < extra_packets; i++) { |
3254 connection_.EnsureWritableAndSendStreamData5(); | 3266 connection_.EnsureWritableAndSendStreamData5(); |
3255 ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); | 3267 ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); |
3256 } | 3268 } |
3257 | 3269 |
3258 // Acknowledge all packets sent so far, except for the lost probe. | 3270 // Acknowledge all packets sent so far, except for the lost probe. |
3259 QuicAckFrame probe_ack = InitAckFrame(creator_->packet_number()); | 3271 QuicAckFrame probe_ack = |
3260 NackPacket(probe_number, &probe_ack); | 3272 ConstructAckFrame(creator_->packet_number(), probe_number); |
3261 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3273 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3262 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 3274 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
3263 ProcessAckPacket(&probe_ack); | 3275 ProcessAckPacket(&probe_ack); |
3264 EXPECT_EQ(initial_mtu, connection_.max_packet_length()); | 3276 EXPECT_EQ(initial_mtu, connection_.max_packet_length()); |
3265 | 3277 |
3266 // Send more packets, and ensure that none of them sets the alarm. | 3278 // Send more packets, and ensure that none of them sets the alarm. |
3267 for (QuicPacketCount i = 0; i < 4 * kPacketsBetweenMtuProbesBase; i++) { | 3279 for (QuicPacketCount i = 0; i < 4 * kPacketsBetweenMtuProbesBase; i++) { |
3268 connection_.EnsureWritableAndSendStreamData5(); | 3280 connection_.EnsureWritableAndSendStreamData5(); |
3269 ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); | 3281 ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); |
3270 } | 3282 } |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); | 4372 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
4361 } | 4373 } |
4362 | 4374 |
4363 TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { | 4375 TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { |
4364 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4376 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4365 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, NO_FIN, | 4377 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, NO_FIN, |
4366 nullptr); | 4378 nullptr); |
4367 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 3, NO_FIN, | 4379 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 3, NO_FIN, |
4368 nullptr); | 4380 nullptr); |
4369 // Ack the second packet, which will retransmit the first packet. | 4381 // Ack the second packet, which will retransmit the first packet. |
4370 QuicAckFrame ack = InitAckFrame(2); | 4382 QuicAckFrame ack = ConstructAckFrame(2, 1); |
4371 NackPacket(1, &ack); | |
4372 SendAlgorithmInterface::CongestionVector lost_packets; | 4383 SendAlgorithmInterface::CongestionVector lost_packets; |
4373 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); | 4384 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
4374 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 4385 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
4375 .WillOnce(SetArgPointee<4>(lost_packets)); | 4386 .WillOnce(SetArgPointee<4>(lost_packets)); |
4376 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 4387 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
4377 ProcessAckPacket(&ack); | 4388 ProcessAckPacket(&ack); |
4378 EXPECT_EQ(1u, writer_->frame_count()); | 4389 EXPECT_EQ(1u, writer_->frame_count()); |
4379 EXPECT_EQ(1u, writer_->stream_frames().size()); | 4390 EXPECT_EQ(1u, writer_->stream_frames().size()); |
4380 writer_->Reset(); | 4391 writer_->Reset(); |
4381 | 4392 |
4382 // Now ack the retransmission, which will both raise the high water mark | 4393 // Now ack the retransmission, which will both raise the high water mark |
4383 // and see if there is more data to send. | 4394 // and see if there is more data to send. |
4384 ack = InitAckFrame(3); | 4395 ack = ConstructAckFrame(3, 1); |
4385 NackPacket(1, &ack); | |
4386 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); | 4396 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); |
4387 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 4397 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
4388 ProcessAckPacket(&ack); | 4398 ProcessAckPacket(&ack); |
4389 | 4399 |
4390 // Check that no packet is sent and the ack alarm isn't set. | 4400 // Check that no packet is sent and the ack alarm isn't set. |
4391 EXPECT_EQ(0u, writer_->frame_count()); | 4401 EXPECT_EQ(0u, writer_->frame_count()); |
4392 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); | 4402 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
4393 writer_->Reset(); | 4403 writer_->Reset(); |
4394 | 4404 |
4395 // Send the same ack, but send both data and an ack together. | 4405 // Send the same ack, but send both data and an ack together. |
4396 ack = InitAckFrame(3); | 4406 ack = ConstructAckFrame(3, 1); |
4397 NackPacket(1, &ack); | |
4398 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); | 4407 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)); |
4399 EXPECT_CALL(visitor_, OnCanWrite()) | 4408 EXPECT_CALL(visitor_, OnCanWrite()) |
4400 .WillOnce(IgnoreResult(InvokeWithoutArgs( | 4409 .WillOnce(IgnoreResult(InvokeWithoutArgs( |
4401 &connection_, &TestConnection::EnsureWritableAndSendStreamData5))); | 4410 &connection_, &TestConnection::EnsureWritableAndSendStreamData5))); |
4402 ProcessAckPacket(&ack); | 4411 ProcessAckPacket(&ack); |
4403 | 4412 |
4404 // Check that ack is bundled with outgoing data and the delayed ack | 4413 // Check that ack is bundled with outgoing data and the delayed ack |
4405 // alarm is reset. | 4414 // alarm is reset. |
4406 if (GetParam().no_stop_waiting) { | 4415 if (GetParam().no_stop_waiting) { |
4407 EXPECT_EQ(2u, writer_->frame_count()); | 4416 EXPECT_EQ(2u, writer_->frame_count()); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4669 | 4678 |
4670 // 2 retransmissions due to rto, 1 due to explicit nack. | 4679 // 2 retransmissions due to rto, 1 due to explicit nack. |
4671 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 4680 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
4672 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(3); | 4681 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(3); |
4673 | 4682 |
4674 // Retransmit due to RTO. | 4683 // Retransmit due to RTO. |
4675 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10)); | 4684 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10)); |
4676 connection_.GetRetransmissionAlarm()->Fire(); | 4685 connection_.GetRetransmissionAlarm()->Fire(); |
4677 | 4686 |
4678 // Retransmit due to explicit nacks. | 4687 // Retransmit due to explicit nacks. |
4679 QuicAckFrame nack_three = InitAckFrame(4); | 4688 QuicAckFrame nack_three; |
4680 NackPacket(3, &nack_three); | 4689 nack_three.packets.Add(2); |
4681 NackPacket(1, &nack_three); | 4690 nack_three.packets.Add(4); |
| 4691 nack_three.largest_observed = 4; |
| 4692 |
4682 SendAlgorithmInterface::CongestionVector lost_packets; | 4693 SendAlgorithmInterface::CongestionVector lost_packets; |
4683 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); | 4694 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
4684 lost_packets.push_back(std::make_pair(3, kMaxPacketSize)); | 4695 lost_packets.push_back(std::make_pair(3, kMaxPacketSize)); |
4685 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 4696 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
4686 .WillOnce(SetArgPointee<4>(lost_packets)); | 4697 .WillOnce(SetArgPointee<4>(lost_packets)); |
4687 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 4698 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
4688 EXPECT_CALL(visitor_, OnCanWrite()); | 4699 EXPECT_CALL(visitor_, OnCanWrite()); |
4689 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4700 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4690 ProcessAckPacket(&nack_three); | 4701 ProcessAckPacket(&nack_three); |
4691 | 4702 |
(...skipping 18 matching lines...) Expand all Loading... |
4710 header.packet_number = 1; | 4721 header.packet_number = 1; |
4711 header.public_header.version_flag = false; | 4722 header.public_header.version_flag = false; |
4712 | 4723 |
4713 QuicConnectionCloseFrame qccf; | 4724 QuicConnectionCloseFrame qccf; |
4714 qccf.error_code = QUIC_PEER_GOING_AWAY; | 4725 qccf.error_code = QUIC_PEER_GOING_AWAY; |
4715 | 4726 |
4716 QuicFrames frames; | 4727 QuicFrames frames; |
4717 frames.push_back(QuicFrame(&frame1_)); | 4728 frames.push_back(QuicFrame(&frame1_)); |
4718 frames.push_back(QuicFrame(&qccf)); | 4729 frames.push_back(QuicFrame(&qccf)); |
4719 std::unique_ptr<QuicPacket> packet(ConstructPacket(header, frames)); | 4730 std::unique_ptr<QuicPacket> packet(ConstructPacket(header, frames)); |
4720 EXPECT_TRUE(nullptr != packet.get()); | 4731 EXPECT_TRUE(nullptr != packet); |
4721 char buffer[kMaxPacketSize]; | 4732 char buffer[kMaxPacketSize]; |
4722 size_t encrypted_length = peer_framer_.EncryptPayload( | 4733 size_t encrypted_length = peer_framer_.EncryptPayload( |
4723 ENCRYPTION_NONE, 1, *packet, buffer, kMaxPacketSize); | 4734 ENCRYPTION_NONE, 1, *packet, buffer, kMaxPacketSize); |
4724 | 4735 |
4725 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PEER_GOING_AWAY, _, | 4736 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PEER_GOING_AWAY, _, |
4726 ConnectionCloseSource::FROM_PEER)); | 4737 ConnectionCloseSource::FROM_PEER)); |
4727 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1); | 4738 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1); |
4728 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4739 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4729 | 4740 |
4730 connection_.ProcessUdpPacket( | 4741 connection_.ProcessUdpPacket( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4817 // Send some data, which will register the listener to be notified. This will | 4828 // Send some data, which will register the listener to be notified. This will |
4818 // not be ACKed and so the listener should never be called. | 4829 // not be ACKed and so the listener should never be called. |
4819 connection_.SendStreamDataWithString(1, "foo", 0, NO_FIN, listener); | 4830 connection_.SendStreamDataWithString(1, "foo", 0, NO_FIN, listener); |
4820 | 4831 |
4821 // Send some other data which we will ACK. | 4832 // Send some other data which we will ACK. |
4822 connection_.SendStreamDataWithString(1, "foo", 0, NO_FIN, nullptr); | 4833 connection_.SendStreamDataWithString(1, "foo", 0, NO_FIN, nullptr); |
4823 connection_.SendStreamDataWithString(1, "bar", 0, NO_FIN, nullptr); | 4834 connection_.SendStreamDataWithString(1, "bar", 0, NO_FIN, nullptr); |
4824 | 4835 |
4825 // Now we receive ACK for packets 2 and 3, but importantly missing packet 1 | 4836 // Now we receive ACK for packets 2 and 3, but importantly missing packet 1 |
4826 // which we registered to be notified about. | 4837 // which we registered to be notified about. |
4827 QuicAckFrame frame = InitAckFrame(3); | 4838 QuicAckFrame frame = ConstructAckFrame(3, 1); |
4828 NackPacket(1, &frame); | |
4829 SendAlgorithmInterface::CongestionVector lost_packets; | 4839 SendAlgorithmInterface::CongestionVector lost_packets; |
4830 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); | 4840 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
4831 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 4841 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
4832 .WillOnce(SetArgPointee<4>(lost_packets)); | 4842 .WillOnce(SetArgPointee<4>(lost_packets)); |
4833 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 4843 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
4834 EXPECT_CALL(*listener, OnPacketRetransmitted(3)).Times(1); | 4844 EXPECT_CALL(*listener, OnPacketRetransmitted(3)).Times(1); |
4835 ProcessAckPacket(&frame); | 4845 ProcessAckPacket(&frame); |
4836 } | 4846 } |
4837 | 4847 |
4838 TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { | 4848 TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { |
4839 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4849 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4840 | 4850 |
4841 // Create a listener which we expect to be called. | 4851 // Create a listener which we expect to be called. |
4842 QuicReferenceCountedPointer<MockAckListener> listener(new MockAckListener); | 4852 QuicReferenceCountedPointer<MockAckListener> listener(new MockAckListener); |
4843 EXPECT_CALL(*listener, OnPacketRetransmitted(3)).Times(1); | 4853 EXPECT_CALL(*listener, OnPacketRetransmitted(3)).Times(1); |
4844 EXPECT_CALL(*listener, OnPacketAcked(3, _)).Times(1); | 4854 EXPECT_CALL(*listener, OnPacketAcked(3, _)).Times(1); |
4845 | 4855 |
4846 // Send four packets, and register to be notified on ACK of packet 2. | 4856 // Send four packets, and register to be notified on ACK of packet 2. |
4847 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); | 4857 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); |
4848 connection_.SendStreamDataWithString(3, "bar", 0, NO_FIN, listener); | 4858 connection_.SendStreamDataWithString(3, "bar", 0, NO_FIN, listener); |
4849 connection_.SendStreamDataWithString(3, "baz", 0, NO_FIN, nullptr); | 4859 connection_.SendStreamDataWithString(3, "baz", 0, NO_FIN, nullptr); |
4850 connection_.SendStreamDataWithString(3, "qux", 0, NO_FIN, nullptr); | 4860 connection_.SendStreamDataWithString(3, "qux", 0, NO_FIN, nullptr); |
4851 | 4861 |
4852 // Now we receive ACK for packets 1, 3, and 4 and lose 2. | 4862 // Now we receive ACK for packets 1, 3, and 4 and lose 2. |
4853 QuicAckFrame frame = InitAckFrame(4); | 4863 QuicAckFrame frame = ConstructAckFrame(4, 2); |
4854 NackPacket(2, &frame); | |
4855 SendAlgorithmInterface::CongestionVector lost_packets; | 4864 SendAlgorithmInterface::CongestionVector lost_packets; |
4856 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); | 4865 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
4857 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 4866 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
4858 .WillOnce(SetArgPointee<4>(lost_packets)); | 4867 .WillOnce(SetArgPointee<4>(lost_packets)); |
4859 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 4868 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
4860 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 4869 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
4861 ProcessAckPacket(&frame); | 4870 ProcessAckPacket(&frame); |
4862 | 4871 |
4863 // Now we get an ACK for packet 5 (retransmitted packet 2), which should | 4872 // Now we get an ACK for packet 5 (retransmitted packet 2), which should |
4864 // trigger the callback. | 4873 // trigger the callback. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4917 QuicReferenceCountedPointer<MockAckListener> listener( | 4926 QuicReferenceCountedPointer<MockAckListener> listener( |
4918 new StrictMock<MockAckListener>()); | 4927 new StrictMock<MockAckListener>()); |
4919 | 4928 |
4920 // Send four packets, and register to be notified on ACK of packet 2. | 4929 // Send four packets, and register to be notified on ACK of packet 2. |
4921 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); | 4930 connection_.SendStreamDataWithString(3, "foo", 0, NO_FIN, nullptr); |
4922 connection_.SendStreamDataWithString(3, "bar", 0, NO_FIN, listener); | 4931 connection_.SendStreamDataWithString(3, "bar", 0, NO_FIN, listener); |
4923 connection_.SendStreamDataWithString(3, "baz", 0, NO_FIN, nullptr); | 4932 connection_.SendStreamDataWithString(3, "baz", 0, NO_FIN, nullptr); |
4924 connection_.SendStreamDataWithString(3, "qux", 0, NO_FIN, nullptr); | 4933 connection_.SendStreamDataWithString(3, "qux", 0, NO_FIN, nullptr); |
4925 | 4934 |
4926 // Now we receive ACK for packets 1, 3, and 4 and lose 2. | 4935 // Now we receive ACK for packets 1, 3, and 4 and lose 2. |
4927 QuicAckFrame frame = InitAckFrame(4); | 4936 QuicAckFrame frame = ConstructAckFrame(4, 2); |
4928 NackPacket(2, &frame); | |
4929 EXPECT_CALL(*listener, OnPacketRetransmitted(_)); | 4937 EXPECT_CALL(*listener, OnPacketRetransmitted(_)); |
4930 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4938 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4931 SendAlgorithmInterface::CongestionVector lost_packets; | 4939 SendAlgorithmInterface::CongestionVector lost_packets; |
4932 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); | 4940 lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
4933 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) | 4941 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _)) |
4934 .WillOnce(SetArgPointee<4>(lost_packets)); | 4942 .WillOnce(SetArgPointee<4>(lost_packets)); |
4935 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); | 4943 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); |
4936 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 4944 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
4937 ProcessAckPacket(&frame); | 4945 ProcessAckPacket(&frame); |
4938 | 4946 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5253 error_details, ConnectionCloseSource::FROM_PEER)); | 5261 error_details, ConnectionCloseSource::FROM_PEER)); |
5254 connection_.set_perspective(Perspective::IS_CLIENT); | 5262 connection_.set_perspective(Perspective::IS_CLIENT); |
5255 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, | 5263 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, |
5256 error_details, | 5264 error_details, |
5257 ConnectionCloseBehavior::SILENT_CLOSE); | 5265 ConnectionCloseBehavior::SILENT_CLOSE); |
5258 } | 5266 } |
5259 | 5267 |
5260 } // namespace | 5268 } // namespace |
5261 } // namespace test | 5269 } // namespace test |
5262 } // namespace net | 5270 } // namespace net |
OLD | NEW |