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 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 AckBundling ack_mode) | 2259 AckBundling ack_mode) |
2260 : connection_(connection), | 2260 : connection_(connection), |
2261 already_in_batch_mode_(connection != nullptr && | 2261 already_in_batch_mode_(connection != nullptr && |
2262 connection->packet_generator_.InBatchMode()) { | 2262 connection->packet_generator_.InBatchMode()) { |
2263 if (connection_ == nullptr) { | 2263 if (connection_ == nullptr) { |
2264 return; | 2264 return; |
2265 } | 2265 } |
2266 // Move generator into batch mode. If caller wants us to include an ack, | 2266 // Move generator into batch mode. If caller wants us to include an ack, |
2267 // check the delayed-ack timer to see if there's ack info to be sent. | 2267 // check the delayed-ack timer to see if there's ack info to be sent. |
2268 if (!already_in_batch_mode_) { | 2268 if (!already_in_batch_mode_) { |
2269 DVLOG(1) << "Entering Batch Mode."; | 2269 DVLOG(2) << "Entering Batch Mode."; |
2270 connection_->packet_generator_.StartBatchOperations(); | 2270 connection_->packet_generator_.StartBatchOperations(); |
2271 } | 2271 } |
2272 if (ShouldSendAck(ack_mode)) { | 2272 if (ShouldSendAck(ack_mode)) { |
2273 DVLOG(1) << "Bundling ack with outgoing packet."; | 2273 DVLOG(1) << "Bundling ack with outgoing packet."; |
2274 DCHECK(ack_mode == SEND_ACK || connection_->ack_frame_updated() || | 2274 DCHECK(ack_mode == SEND_ACK || connection_->ack_frame_updated() || |
2275 connection_->stop_waiting_count_ > 1); | 2275 connection_->stop_waiting_count_ > 1); |
2276 connection_->SendAck(); | 2276 connection_->SendAck(); |
2277 } | 2277 } |
2278 } | 2278 } |
2279 | 2279 |
(...skipping 12 matching lines...) Expand all Loading... |
2292 return true; | 2292 return true; |
2293 } | 2293 } |
2294 } | 2294 } |
2295 | 2295 |
2296 QuicConnection::ScopedPacketBundler::~ScopedPacketBundler() { | 2296 QuicConnection::ScopedPacketBundler::~ScopedPacketBundler() { |
2297 if (connection_ == nullptr) { | 2297 if (connection_ == nullptr) { |
2298 return; | 2298 return; |
2299 } | 2299 } |
2300 // If we changed the generator's batch state, restore original batch state. | 2300 // If we changed the generator's batch state, restore original batch state. |
2301 if (!already_in_batch_mode_) { | 2301 if (!already_in_batch_mode_) { |
2302 DVLOG(1) << "Leaving Batch Mode."; | 2302 DVLOG(2) << "Leaving Batch Mode."; |
2303 connection_->packet_generator_.FinishBatchOperations(); | 2303 connection_->packet_generator_.FinishBatchOperations(); |
2304 } | 2304 } |
2305 DCHECK_EQ(already_in_batch_mode_, | 2305 DCHECK_EQ(already_in_batch_mode_, |
2306 connection_->packet_generator_.InBatchMode()); | 2306 connection_->packet_generator_.InBatchMode()); |
2307 } | 2307 } |
2308 | 2308 |
2309 QuicConnection::ScopedRetransmissionScheduler::ScopedRetransmissionScheduler( | 2309 QuicConnection::ScopedRetransmissionScheduler::ScopedRetransmissionScheduler( |
2310 QuicConnection* connection) | 2310 QuicConnection* connection) |
2311 : connection_(connection), | 2311 : connection_(connection), |
2312 already_delayed_(connection_->delay_setting_retransmission_alarm_) { | 2312 already_delayed_(connection_->delay_setting_retransmission_alarm_) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 // the sender and a signaling mechanism -- if the sender uses a | 2511 // the sender and a signaling mechanism -- if the sender uses a |
2512 // different MinRTO, we may get spurious retransmissions. May not have | 2512 // different MinRTO, we may get spurious retransmissions. May not have |
2513 // any benefits, but if the delayed ack becomes a significant source | 2513 // any benefits, but if the delayed ack becomes a significant source |
2514 // of (likely, tail) latency, then consider such a mechanism. | 2514 // of (likely, tail) latency, then consider such a mechanism. |
2515 const QuicTime::Delta QuicConnection::DelayedAckTime() { | 2515 const QuicTime::Delta QuicConnection::DelayedAckTime() { |
2516 return QuicTime::Delta::FromMilliseconds( | 2516 return QuicTime::Delta::FromMilliseconds( |
2517 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); | 2517 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); |
2518 } | 2518 } |
2519 | 2519 |
2520 } // namespace net | 2520 } // namespace net |
OLD | NEW |