| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 QuicConnection* connection_; | 146 QuicConnection* connection_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(TimeoutAlarm); | 148 DISALLOW_COPY_AND_ASSIGN(TimeoutAlarm); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 class PingAlarm : public QuicAlarm::Delegate { | 151 class PingAlarm : public QuicAlarm::Delegate { |
| 152 public: | 152 public: |
| 153 explicit PingAlarm(QuicConnection* connection) : connection_(connection) {} | 153 explicit PingAlarm(QuicConnection* connection) : connection_(connection) {} |
| 154 | 154 |
| 155 QuicTime OnAlarm() override { | 155 QuicTime OnAlarm() override { |
| 156 connection_->SendPing(); | 156 connection_->OnPingTimeout(); |
| 157 return QuicTime::Zero(); | 157 return QuicTime::Zero(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 private: | 160 private: |
| 161 QuicConnection* connection_; | 161 QuicConnection* connection_; |
| 162 | 162 |
| 163 DISALLOW_COPY_AND_ASSIGN(PingAlarm); | 163 DISALLOW_COPY_AND_ASSIGN(PingAlarm); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 class MtuDiscoveryAlarm : public QuicAlarm::Delegate { | 166 class MtuDiscoveryAlarm : public QuicAlarm::Delegate { |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 has_forward_secure_encrypter_ && | 1804 has_forward_secure_encrypter_ && |
| 1805 packet->packet_number >= first_required_forward_secure_packet_ - 1) { | 1805 packet->packet_number >= first_required_forward_secure_packet_ - 1) { |
| 1806 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); | 1806 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); |
| 1807 } | 1807 } |
| 1808 } | 1808 } |
| 1809 | 1809 |
| 1810 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { | 1810 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { |
| 1811 return UNKNOWN; | 1811 return UNKNOWN; |
| 1812 } | 1812 } |
| 1813 | 1813 |
| 1814 void QuicConnection::OnPingTimeout() { |
| 1815 if (!retransmission_alarm_->IsSet()) { |
| 1816 SendPing(); |
| 1817 } |
| 1818 } |
| 1819 |
| 1814 void QuicConnection::SendPing() { | 1820 void QuicConnection::SendPing() { |
| 1815 if (retransmission_alarm_->IsSet()) { | |
| 1816 return; | |
| 1817 } | |
| 1818 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); | 1821 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); |
| 1819 } | 1822 } |
| 1820 | 1823 |
| 1821 void QuicConnection::SendAck() { | 1824 void QuicConnection::SendAck() { |
| 1822 ack_alarm_->Cancel(); | 1825 ack_alarm_->Cancel(); |
| 1823 ack_queued_ = false; | 1826 ack_queued_ = false; |
| 1824 stop_waiting_count_ = 0; | 1827 stop_waiting_count_ = 0; |
| 1825 num_retransmittable_packets_received_since_last_ack_sent_ = 0; | 1828 num_retransmittable_packets_received_since_last_ack_sent_ = 0; |
| 1826 num_packets_received_since_last_ack_sent_ = 0; | 1829 num_packets_received_since_last_ack_sent_ = 0; |
| 1827 | 1830 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2403 SendMtuDiscoveryPacket(mtu_discovery_target_); |
| 2401 | 2404 |
| 2402 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2405 DCHECK(!mtu_discovery_alarm_->IsSet()); |
| 2403 } | 2406 } |
| 2404 | 2407 |
| 2405 bool QuicConnection::ack_frame_updated() const { | 2408 bool QuicConnection::ack_frame_updated() const { |
| 2406 return received_packet_manager_.ack_frame_updated(); | 2409 return received_packet_manager_.ack_frame_updated(); |
| 2407 } | 2410 } |
| 2408 | 2411 |
| 2409 } // namespace net | 2412 } // namespace net |
| OLD | NEW |