| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 net::ADDRESS_FAMILY_UNSPECIFIED; | 81 net::ADDRESS_FAMILY_UNSPECIFIED; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // An alarm that is scheduled to send an ack if a timeout occurs. | 84 // An alarm that is scheduled to send an ack if a timeout occurs. |
| 85 class AckAlarm : public QuicAlarm::Delegate { | 85 class AckAlarm : public QuicAlarm::Delegate { |
| 86 public: | 86 public: |
| 87 explicit AckAlarm(QuicConnection* connection) : connection_(connection) {} | 87 explicit AckAlarm(QuicConnection* connection) : connection_(connection) {} |
| 88 | 88 |
| 89 void OnAlarm() override { | 89 void OnAlarm() override { |
| 90 DCHECK(connection_->ack_frame_updated()); | 90 DCHECK(connection_->ack_frame_updated()); |
| 91 connection_->SendAck(); | 91 QuicConnection::ScopedPacketBundler bundler(connection_, |
| 92 QuicConnection::SEND_ACK); |
| 92 } | 93 } |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 QuicConnection* connection_; | 96 QuicConnection* connection_; |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(AckAlarm); | 98 DISALLOW_COPY_AND_ASSIGN(AckAlarm); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 // This alarm will be scheduled any time a data-bearing packet is sent out. | 101 // This alarm will be scheduled any time a data-bearing packet is sent out. |
| 101 // When the alarm goes off, the connection checks to see if the oldest packets | 102 // When the alarm goes off, the connection checks to see if the oldest packets |
| (...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 } | 2329 } |
| 2329 | 2330 |
| 2330 StringPiece QuicConnection::GetCurrentPacket() { | 2331 StringPiece QuicConnection::GetCurrentPacket() { |
| 2331 if (current_packet_data_ == nullptr) { | 2332 if (current_packet_data_ == nullptr) { |
| 2332 return StringPiece(); | 2333 return StringPiece(); |
| 2333 } | 2334 } |
| 2334 return StringPiece(current_packet_data_, last_size_); | 2335 return StringPiece(current_packet_data_, last_size_); |
| 2335 } | 2336 } |
| 2336 | 2337 |
| 2337 } // namespace net | 2338 } // namespace net |
| OLD | NEW |