| 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 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 return false; | 1713 return false; |
| 1714 } | 1714 } |
| 1715 | 1715 |
| 1716 void QuicConnection::OnWriteError(int error_code) { | 1716 void QuicConnection::OnWriteError(int error_code) { |
| 1717 DVLOG(1) << ENDPOINT << "Write failed with error: " << error_code | 1717 DVLOG(1) << ENDPOINT << "Write failed with error: " << error_code |
| 1718 << " (" << ErrorToString(error_code) << ")"; | 1718 << " (" << ErrorToString(error_code) << ")"; |
| 1719 // We can't send an error as the socket is presumably borked. | 1719 // We can't send an error as the socket is presumably borked. |
| 1720 CloseConnection(QUIC_PACKET_WRITE_ERROR, false); | 1720 CloseConnection(QUIC_PACKET_WRITE_ERROR, false); |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 void QuicConnection::OnSerializedPacket( | 1723 void QuicConnection::OnSerializedPacket(SerializedPacket* serialized_packet) { |
| 1724 const SerializedPacket& serialized_packet) { | 1724 if (serialized_packet->packet == nullptr) { |
| 1725 if (serialized_packet.packet == nullptr) { | |
| 1726 // We failed to serialize the packet, so close the connection. | 1725 // We failed to serialize the packet, so close the connection. |
| 1727 // CloseConnection does not send close packet, so no infinite loop here. | 1726 // CloseConnection does not send close packet, so no infinite loop here. |
| 1728 CloseConnection(QUIC_ENCRYPTION_FAILURE, false); | 1727 CloseConnection(QUIC_ENCRYPTION_FAILURE, false); |
| 1729 return; | 1728 return; |
| 1730 } | 1729 } |
| 1731 if (serialized_packet.is_fec_packet && fec_alarm_->IsSet()) { | 1730 if (serialized_packet->is_fec_packet && fec_alarm_->IsSet()) { |
| 1732 // If an FEC packet is serialized with the FEC alarm set, cancel the alarm. | 1731 // If an FEC packet is serialized with the FEC alarm set, cancel the alarm. |
| 1733 fec_alarm_->Cancel(); | 1732 fec_alarm_->Cancel(); |
| 1734 } | 1733 } |
| 1735 SendOrQueuePacket(QueuedPacket(serialized_packet)); | 1734 SendOrQueuePacket(QueuedPacket(*serialized_packet)); |
| 1736 } | 1735 } |
| 1737 | 1736 |
| 1738 void QuicConnection::OnResetFecGroup() { | 1737 void QuicConnection::OnResetFecGroup() { |
| 1739 if (!fec_alarm_->IsSet()) { | 1738 if (!fec_alarm_->IsSet()) { |
| 1740 return; | 1739 return; |
| 1741 } | 1740 } |
| 1742 // If an FEC Group is closed with the FEC alarm set, cancel the alarm. | 1741 // If an FEC Group is closed with the FEC alarm set, cancel the alarm. |
| 1743 fec_alarm_->Cancel(); | 1742 fec_alarm_->Cancel(); |
| 1744 } | 1743 } |
| 1745 | 1744 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2399 | 2398 |
| 2400 bool QuicConnection::ack_frame_updated() const { | 2399 bool QuicConnection::ack_frame_updated() const { |
| 2401 return received_packet_manager_.ack_frame_updated(); | 2400 return received_packet_manager_.ack_frame_updated(); |
| 2402 } | 2401 } |
| 2403 | 2402 |
| 2404 void QuicConnection::set_ack_frame_updated(bool updated) { | 2403 void QuicConnection::set_ack_frame_updated(bool updated) { |
| 2405 received_packet_manager_.set_ack_frame_updated(updated); | 2404 received_packet_manager_.set_ack_frame_updated(updated); |
| 2406 } | 2405 } |
| 2407 | 2406 |
| 2408 } // namespace net | 2407 } // namespace net |
| OLD | NEW |