| 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/core/quic_connection.h" | 5 #include "net/quic/core/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 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 // There are two important approaches to remedy this situation: | 2372 // There are two important approaches to remedy this situation: |
| 2373 // (1) Instantiate ScopedPacketBundler before performing multiple subsequent | 2373 // (1) Instantiate ScopedPacketBundler before performing multiple subsequent |
| 2374 // writes, thus deferring this check until all writes are done. | 2374 // writes, thus deferring this check until all writes are done. |
| 2375 // (2) Write data in chunks sufficiently large so that they cause the | 2375 // (2) Write data in chunks sufficiently large so that they cause the |
| 2376 // connection to be limited by the congestion control. Typically, this | 2376 // connection to be limited by the congestion control. Typically, this |
| 2377 // would mean writing chunks larger than the product of the current | 2377 // would mean writing chunks larger than the product of the current |
| 2378 // pacing rate and the pacer granularity. So, for instance, if the | 2378 // pacing rate and the pacer granularity. So, for instance, if the |
| 2379 // pacing rate of the connection is 1 Gbps, and the pacer granularity is | 2379 // pacing rate of the connection is 1 Gbps, and the pacer granularity is |
| 2380 // 1 ms, the caller should send at least 125k bytes in order to not | 2380 // 1 ms, the caller should send at least 125k bytes in order to not |
| 2381 // be marked as application-limited. | 2381 // be marked as application-limited. |
| 2382 if (FLAGS_quic_enable_app_limited_check) { | 2382 connection_->CheckIfApplicationLimited(); |
| 2383 connection_->CheckIfApplicationLimited(); | |
| 2384 } | |
| 2385 } | 2383 } |
| 2386 DCHECK_EQ(already_in_batch_mode_, | 2384 DCHECK_EQ(already_in_batch_mode_, |
| 2387 connection_->packet_generator_.InBatchMode()); | 2385 connection_->packet_generator_.InBatchMode()); |
| 2388 } | 2386 } |
| 2389 | 2387 |
| 2390 QuicConnection::ScopedRetransmissionScheduler::ScopedRetransmissionScheduler( | 2388 QuicConnection::ScopedRetransmissionScheduler::ScopedRetransmissionScheduler( |
| 2391 QuicConnection* connection) | 2389 QuicConnection* connection) |
| 2392 : connection_(connection), | 2390 : connection_(connection), |
| 2393 already_delayed_(connection_->delay_setting_retransmission_alarm_) { | 2391 already_delayed_(connection_->delay_setting_retransmission_alarm_) { |
| 2394 connection_->delay_setting_retransmission_alarm_ = true; | 2392 connection_->delay_setting_retransmission_alarm_ = true; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2584 | 2582 |
| 2585 void QuicConnection::CheckIfApplicationLimited() { | 2583 void QuicConnection::CheckIfApplicationLimited() { |
| 2586 if (queued_packets_.empty() && | 2584 if (queued_packets_.empty() && |
| 2587 !sent_packet_manager_->HasPendingRetransmissions() && | 2585 !sent_packet_manager_->HasPendingRetransmissions() && |
| 2588 !visitor_->WillingAndAbleToWrite()) { | 2586 !visitor_->WillingAndAbleToWrite()) { |
| 2589 sent_packet_manager_->OnApplicationLimited(); | 2587 sent_packet_manager_->OnApplicationLimited(); |
| 2590 } | 2588 } |
| 2591 } | 2589 } |
| 2592 | 2590 |
| 2593 } // namespace net | 2591 } // namespace net |
| OLD | NEW |