| 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 <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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 // anymore. | 1752 // anymore. |
| 1753 DVLOG(1) << ENDPOINT << "Dropping NULL encrypted packet: " << packet_number | 1753 DVLOG(1) << ENDPOINT << "Dropping NULL encrypted packet: " << packet_number |
| 1754 << " since the connection is forward secure."; | 1754 << " since the connection is forward secure."; |
| 1755 return true; | 1755 return true; |
| 1756 } | 1756 } |
| 1757 | 1757 |
| 1758 return false; | 1758 return false; |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 void QuicConnection::OnWriteError(int error_code) { | 1761 void QuicConnection::OnWriteError(int error_code) { |
| 1762 if (FLAGS_quic_close_connection_on_packet_too_large && write_error_occured_) { | 1762 if (write_error_occured_) { |
| 1763 // A write error already occurred. The connection is being closed. | 1763 // A write error already occurred. The connection is being closed. |
| 1764 return; | 1764 return; |
| 1765 } | 1765 } |
| 1766 write_error_occured_ = true; | 1766 write_error_occured_ = true; |
| 1767 | 1767 |
| 1768 const string error_details = "Write failed with error: " + | 1768 const string error_details = "Write failed with error: " + |
| 1769 base::IntToString(error_code) + " (" + | 1769 base::IntToString(error_code) + " (" + |
| 1770 ErrorToString(error_code) + ")"; | 1770 ErrorToString(error_code) + ")"; |
| 1771 DVLOG(1) << ENDPOINT << error_details; | 1771 DVLOG(1) << ENDPOINT << error_details; |
| 1772 // We can't send an error as the socket is presumably borked. | 1772 // We can't send an error as the socket is presumably borked. |
| 1773 switch (error_code) { | 1773 switch (error_code) { |
| 1774 case kMessageTooBigErrorCode: | 1774 case kMessageTooBigErrorCode: |
| 1775 if (FLAGS_quic_close_connection_on_packet_too_large) { // NOLINT | 1775 CloseConnection( |
| 1776 CloseConnection( | 1776 QUIC_PACKET_WRITE_ERROR, error_details, |
| 1777 QUIC_PACKET_WRITE_ERROR, error_details, | 1777 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK); |
| 1778 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK); | 1778 break; |
| 1779 break; | |
| 1780 } | |
| 1781 default: | 1779 default: |
| 1782 // We can't send an error as the socket is presumably borked. | 1780 // We can't send an error as the socket is presumably borked. |
| 1783 TearDownLocalConnectionState(QUIC_PACKET_WRITE_ERROR, error_details, | 1781 TearDownLocalConnectionState(QUIC_PACKET_WRITE_ERROR, error_details, |
| 1784 ConnectionCloseSource::FROM_SELF); | 1782 ConnectionCloseSource::FROM_SELF); |
| 1785 } | 1783 } |
| 1786 } | 1784 } |
| 1787 | 1785 |
| 1788 void QuicConnection::OnSerializedPacket(SerializedPacket* serialized_packet) { | 1786 void QuicConnection::OnSerializedPacket(SerializedPacket* serialized_packet) { |
| 1789 DCHECK_NE(kInvalidPathId, serialized_packet->path_id); | 1787 DCHECK_NE(kInvalidPathId, serialized_packet->path_id); |
| 1790 if (serialized_packet->encrypted_buffer == nullptr) { | 1788 if (serialized_packet->encrypted_buffer == nullptr) { |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2525 | 2523 |
| 2526 void QuicConnection::CheckIfApplicationLimited() { | 2524 void QuicConnection::CheckIfApplicationLimited() { |
| 2527 if (queued_packets_.empty() && | 2525 if (queued_packets_.empty() && |
| 2528 !sent_packet_manager_->HasPendingRetransmissions() && | 2526 !sent_packet_manager_->HasPendingRetransmissions() && |
| 2529 !visitor_->WillingAndAbleToWrite()) { | 2527 !visitor_->WillingAndAbleToWrite()) { |
| 2530 sent_packet_manager_->OnApplicationLimited(); | 2528 sent_packet_manager_->OnApplicationLimited(); |
| 2531 } | 2529 } |
| 2532 } | 2530 } |
| 2533 | 2531 |
| 2534 } // namespace net | 2532 } // namespace net |
| OLD | NEW |