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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 QuicConnection* connection_; | 145 QuicConnection* connection_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(TimeoutAlarm); | 147 DISALLOW_COPY_AND_ASSIGN(TimeoutAlarm); |
148 }; | 148 }; |
149 | 149 |
150 class PingAlarm : public QuicAlarm::Delegate { | 150 class PingAlarm : public QuicAlarm::Delegate { |
151 public: | 151 public: |
152 explicit PingAlarm(QuicConnection* connection) : connection_(connection) {} | 152 explicit PingAlarm(QuicConnection* connection) : connection_(connection) {} |
153 | 153 |
154 QuicTime OnAlarm() override { | 154 QuicTime OnAlarm() override { |
155 connection_->SendPing(); | 155 connection_->SendPing(false); |
156 return QuicTime::Zero(); | 156 return QuicTime::Zero(); |
157 } | 157 } |
158 | 158 |
159 private: | 159 private: |
160 QuicConnection* connection_; | 160 QuicConnection* connection_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(PingAlarm); | 162 DISALLOW_COPY_AND_ASSIGN(PingAlarm); |
163 }; | 163 }; |
164 | 164 |
165 class MtuDiscoveryAlarm : public QuicAlarm::Delegate { | 165 class MtuDiscoveryAlarm : public QuicAlarm::Delegate { |
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 packet.serialized_packet.packet_number >= | 1799 packet.serialized_packet.packet_number >= |
1800 first_required_forward_secure_packet_ - 1) { | 1800 first_required_forward_secure_packet_ - 1) { |
1801 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); | 1801 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); |
1802 } | 1802 } |
1803 } | 1803 } |
1804 | 1804 |
1805 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { | 1805 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { |
1806 return UNKNOWN; | 1806 return UNKNOWN; |
1807 } | 1807 } |
1808 | 1808 |
1809 void QuicConnection::SendPing() { | 1809 void QuicConnection::SendPing(bool force) { |
1810 if (retransmission_alarm_->IsSet()) { | 1810 if (!force && retransmission_alarm_->IsSet()) { |
1811 return; | 1811 return; |
1812 } | 1812 } |
1813 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); | 1813 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); |
1814 } | 1814 } |
1815 | 1815 |
1816 void QuicConnection::SendAck() { | 1816 void QuicConnection::SendAck() { |
1817 ack_alarm_->Cancel(); | 1817 ack_alarm_->Cancel(); |
1818 ack_queued_ = false; | 1818 ack_queued_ = false; |
1819 stop_waiting_count_ = 0; | 1819 stop_waiting_count_ = 0; |
1820 num_retransmittable_packets_received_since_last_ack_sent_ = 0; | 1820 num_retransmittable_packets_received_since_last_ack_sent_ = 0; |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2391 SendMtuDiscoveryPacket(mtu_discovery_target_); |
2392 | 2392 |
2393 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2393 DCHECK(!mtu_discovery_alarm_->IsSet()); |
2394 } | 2394 } |
2395 | 2395 |
2396 bool QuicConnection::ack_frame_updated() const { | 2396 bool QuicConnection::ack_frame_updated() const { |
2397 return received_packet_manager_.ack_frame_updated(); | 2397 return received_packet_manager_.ack_frame_updated(); |
2398 } | 2398 } |
2399 | 2399 |
2400 } // namespace net | 2400 } // namespace net |
OLD | NEW |