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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 packet.serialized_packet.packet_number >= | 1815 packet.serialized_packet.packet_number >= |
1816 first_required_forward_secure_packet_ - 1) { | 1816 first_required_forward_secure_packet_ - 1) { |
1817 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); | 1817 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); |
1818 } | 1818 } |
1819 } | 1819 } |
1820 | 1820 |
1821 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { | 1821 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { |
1822 return UNKNOWN; | 1822 return UNKNOWN; |
1823 } | 1823 } |
1824 | 1824 |
1825 void QuicConnection::SendPing() { | 1825 void QuicConnection::SendPing(bool force) { |
1826 if (retransmission_alarm_->IsSet()) { | 1826 if (!force && retransmission_alarm_->IsSet()) { |
1827 return; | 1827 return; |
1828 } | 1828 } |
1829 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); | 1829 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); |
1830 } | 1830 } |
1831 | 1831 |
1832 void QuicConnection::SendAck() { | 1832 void QuicConnection::SendAck() { |
1833 ack_alarm_->Cancel(); | 1833 ack_alarm_->Cancel(); |
1834 ack_queued_ = false; | 1834 ack_queued_ = false; |
1835 stop_waiting_count_ = 0; | 1835 stop_waiting_count_ = 0; |
1836 num_retransmittable_packets_received_since_last_ack_sent_ = 0; | 1836 num_retransmittable_packets_received_since_last_ack_sent_ = 0; |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2413 SendMtuDiscoveryPacket(mtu_discovery_target_); |
2414 | 2414 |
2415 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2415 DCHECK(!mtu_discovery_alarm_->IsSet()); |
2416 } | 2416 } |
2417 | 2417 |
2418 bool QuicConnection::ack_frame_updated() const { | 2418 bool QuicConnection::ack_frame_updated() const { |
2419 return received_packet_manager_.ack_frame_updated(); | 2419 return received_packet_manager_.ack_frame_updated(); |
2420 } | 2420 } |
2421 | 2421 |
2422 } // namespace net | 2422 } // namespace net |
OLD | NEW |