| 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 QuicStreamOffset byte_offset) { | 1196 QuicStreamOffset byte_offset) { |
| 1197 // Opportunistically bundle an ack with this outgoing packet. | 1197 // Opportunistically bundle an ack with this outgoing packet. |
| 1198 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); | 1198 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
| 1199 packet_generator_.AddControlFrame( | 1199 packet_generator_.AddControlFrame( |
| 1200 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); | 1200 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 void QuicConnection::SendBlocked(QuicStreamId id) { | 1203 void QuicConnection::SendBlocked(QuicStreamId id) { |
| 1204 // Opportunistically bundle an ack with this outgoing packet. | 1204 // Opportunistically bundle an ack with this outgoing packet. |
| 1205 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); | 1205 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
| 1206 packet_generator_.AddControlFrame(QuicFrame(new QuicBlockedFrame(id))); | 1206 packet_generator_.AddControlFrame(QuicFrame(QuicBlockedFrame(id))); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 const QuicConnectionStats& QuicConnection::GetStats() { | 1209 const QuicConnectionStats& QuicConnection::GetStats() { |
| 1210 const RttStats* rtt_stats = sent_packet_manager_.GetRttStats(); | 1210 const RttStats* rtt_stats = sent_packet_manager_.GetRttStats(); |
| 1211 | 1211 |
| 1212 // Update rtt and estimated bandwidth. | 1212 // Update rtt and estimated bandwidth. |
| 1213 QuicTime::Delta min_rtt = rtt_stats->min_rtt(); | 1213 QuicTime::Delta min_rtt = rtt_stats->min_rtt(); |
| 1214 if (min_rtt.IsZero()) { | 1214 if (min_rtt.IsZero()) { |
| 1215 // If min RTT has not been set, use initial RTT instead. | 1215 // If min RTT has not been set, use initial RTT instead. |
| 1216 min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); | 1216 min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 packet.serialized_packet.packet_number >= | 1755 packet.serialized_packet.packet_number >= |
| 1756 first_required_forward_secure_packet_ - 1) { | 1756 first_required_forward_secure_packet_ - 1) { |
| 1757 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); | 1757 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); |
| 1758 } | 1758 } |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 void QuicConnection::SendPing() { | 1761 void QuicConnection::SendPing() { |
| 1762 if (retransmission_alarm_->IsSet()) { | 1762 if (retransmission_alarm_->IsSet()) { |
| 1763 return; | 1763 return; |
| 1764 } | 1764 } |
| 1765 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame)); | 1765 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); |
| 1766 } | 1766 } |
| 1767 | 1767 |
| 1768 void QuicConnection::SendAck() { | 1768 void QuicConnection::SendAck() { |
| 1769 ack_alarm_->Cancel(); | 1769 ack_alarm_->Cancel(); |
| 1770 ack_queued_ = false; | 1770 ack_queued_ = false; |
| 1771 stop_waiting_count_ = 0; | 1771 stop_waiting_count_ = 0; |
| 1772 num_packets_received_since_last_ack_sent_ = 0; | 1772 num_packets_received_since_last_ack_sent_ = 0; |
| 1773 | 1773 |
| 1774 packet_generator_.SetShouldSendAck(true); | 1774 packet_generator_.SetShouldSendAck(true); |
| 1775 } | 1775 } |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2325 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
| 2326 ++mtu_probe_count_; | 2326 ++mtu_probe_count_; |
| 2327 | 2327 |
| 2328 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2328 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
| 2329 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2329 SendMtuDiscoveryPacket(mtu_discovery_target_); |
| 2330 | 2330 |
| 2331 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2331 DCHECK(!mtu_discovery_alarm_->IsSet()); |
| 2332 } | 2332 } |
| 2333 | 2333 |
| 2334 } // namespace net | 2334 } // namespace net |
| OLD | NEW |