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 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 QuicPacketNumber packet_number = packet.packet_number; | 1741 QuicPacketNumber packet_number = packet.packet_number; |
1742 if (encryption_level_ == ENCRYPTION_FORWARD_SECURE && | 1742 if (encryption_level_ == ENCRYPTION_FORWARD_SECURE && |
1743 packet.encryption_level == ENCRYPTION_NONE) { | 1743 packet.encryption_level == ENCRYPTION_NONE) { |
1744 // Drop packets that are NULL encrypted since the peer won't accept them | 1744 // Drop packets that are NULL encrypted since the peer won't accept them |
1745 // anymore. | 1745 // anymore. |
1746 DVLOG(1) << ENDPOINT << "Dropping NULL encrypted packet: " << packet_number | 1746 DVLOG(1) << ENDPOINT << "Dropping NULL encrypted packet: " << packet_number |
1747 << " since the connection is forward secure."; | 1747 << " since the connection is forward secure."; |
1748 return true; | 1748 return true; |
1749 } | 1749 } |
1750 | 1750 |
1751 // TODO(fayang): Remove IsUnacked and HasRetransmittableFrames from | |
1752 // QuicSentPacketManagerInterface when deprecating | |
1753 // gfe2_reloadable_flag_quic_always_write_queued_retransmissions. | |
1754 if (FLAGS_quic_always_write_queued_retransmissions) { | |
1755 return false; | |
1756 } | |
1757 | |
1758 // If a retransmission has been acked before sending, don't send it. | |
1759 // This occurs if a packet gets serialized, queued, then discarded. | |
1760 if (packet.transmission_type != NOT_RETRANSMISSION && | |
1761 (!sent_packet_manager_->IsUnacked(packet.original_path_id, | |
1762 packet.original_packet_number) || | |
1763 !sent_packet_manager_->HasRetransmittableFrames( | |
1764 packet.original_path_id, packet.original_packet_number))) { | |
1765 DVLOG(1) << ENDPOINT << "Dropping unacked packet: " << packet_number | |
1766 << " A previous transmission was acked while write blocked."; | |
1767 return true; | |
1768 } | |
1769 | |
1770 return false; | 1751 return false; |
1771 } | 1752 } |
1772 | 1753 |
1773 void QuicConnection::OnWriteError(int error_code) { | 1754 void QuicConnection::OnWriteError(int error_code) { |
1774 const string error_details = "Write failed with error: " + | 1755 const string error_details = "Write failed with error: " + |
1775 base::IntToString(error_code) + " (" + | 1756 base::IntToString(error_code) + " (" + |
1776 ErrorToString(error_code) + ")"; | 1757 ErrorToString(error_code) + ")"; |
1777 DVLOG(1) << ENDPOINT << error_details; | 1758 DVLOG(1) << ENDPOINT << error_details; |
1778 // We can't send an error as the socket is presumably borked. | 1759 // We can't send an error as the socket is presumably borked. |
1779 TearDownLocalConnectionState(QUIC_PACKET_WRITE_ERROR, error_details, | 1760 TearDownLocalConnectionState(QUIC_PACKET_WRITE_ERROR, error_details, |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 // the sender and a signaling mechanism -- if the sender uses a | 2494 // the sender and a signaling mechanism -- if the sender uses a |
2514 // different MinRTO, we may get spurious retransmissions. May not have | 2495 // different MinRTO, we may get spurious retransmissions. May not have |
2515 // any benefits, but if the delayed ack becomes a significant source | 2496 // any benefits, but if the delayed ack becomes a significant source |
2516 // of (likely, tail) latency, then consider such a mechanism. | 2497 // of (likely, tail) latency, then consider such a mechanism. |
2517 const QuicTime::Delta QuicConnection::DelayedAckTime() { | 2498 const QuicTime::Delta QuicConnection::DelayedAckTime() { |
2518 return QuicTime::Delta::FromMilliseconds( | 2499 return QuicTime::Delta::FromMilliseconds( |
2519 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); | 2500 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); |
2520 } | 2501 } |
2521 | 2502 |
2522 } // namespace net | 2503 } // namespace net |
OLD | NEW |