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/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 ack_queued_ = false; | 1834 ack_queued_ = false; |
1835 stop_waiting_count_ = 0; | 1835 stop_waiting_count_ = 0; |
1836 num_retransmittable_packets_received_since_last_ack_sent_ = 0; | 1836 num_retransmittable_packets_received_since_last_ack_sent_ = 0; |
1837 last_ack_had_missing_packets_ = received_packet_manager_.HasMissingPackets(); | 1837 last_ack_had_missing_packets_ = received_packet_manager_.HasMissingPackets(); |
1838 num_packets_received_since_last_ack_sent_ = 0; | 1838 num_packets_received_since_last_ack_sent_ = 0; |
1839 | 1839 |
1840 packet_generator_.SetShouldSendAck(true); | 1840 packet_generator_.SetShouldSendAck(true); |
1841 } | 1841 } |
1842 | 1842 |
1843 void QuicConnection::OnRetransmissionTimeout() { | 1843 void QuicConnection::OnRetransmissionTimeout() { |
1844 if (FLAGS_quic_always_has_unacked_packets_on_timeout) { | 1844 DCHECK(sent_packet_manager_.HasUnackedPackets()); |
1845 DCHECK(sent_packet_manager_.HasUnackedPackets()); | |
1846 } else { | |
1847 if (!sent_packet_manager_.HasUnackedPackets()) { | |
1848 return; | |
1849 } | |
1850 } | |
1851 | 1845 |
1852 if (close_connection_after_five_rtos_ && | 1846 if (close_connection_after_five_rtos_ && |
1853 sent_packet_manager_.consecutive_rto_count() >= 4) { | 1847 sent_packet_manager_.consecutive_rto_count() >= 4) { |
1854 // Close on the 5th consecutive RTO, so after 4 previous RTOs have occurred. | 1848 // Close on the 5th consecutive RTO, so after 4 previous RTOs have occurred. |
1855 CloseConnection(QUIC_TOO_MANY_RTOS, "5 consecutive retransmission timeouts", | 1849 CloseConnection(QUIC_TOO_MANY_RTOS, "5 consecutive retransmission timeouts", |
1856 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 1850 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
1857 return; | 1851 return; |
1858 } | 1852 } |
1859 | 1853 |
1860 // Cancel the send alarm to ensure TimeUntilSend is re-evaluated. | 1854 // Cancel the send alarm to ensure TimeUntilSend is re-evaluated. |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 } | 2428 } |
2435 | 2429 |
2436 StringPiece QuicConnection::GetCurrentPacket() { | 2430 StringPiece QuicConnection::GetCurrentPacket() { |
2437 if (current_packet_data_ == nullptr) { | 2431 if (current_packet_data_ == nullptr) { |
2438 return StringPiece(); | 2432 return StringPiece(); |
2439 } | 2433 } |
2440 return StringPiece(current_packet_data_, last_size_); | 2434 return StringPiece(current_packet_data_, last_size_); |
2441 } | 2435 } |
2442 | 2436 |
2443 } // namespace net | 2437 } // namespace net |
OLD | NEW |