OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_flow_controller.h" | 5 #include "net/quic/quic_flow_controller.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 send_window_offset_(send_window_offset), | 29 send_window_offset_(send_window_offset), |
30 receive_window_offset_(receive_window_offset), | 30 receive_window_offset_(receive_window_offset), |
31 max_receive_window_(max_receive_window), | 31 max_receive_window_(max_receive_window), |
32 last_blocked_send_window_offset_(0) { | 32 last_blocked_send_window_offset_(0) { |
33 DVLOG(1) << ENDPOINT << "Created flow controller for stream " << id_ | 33 DVLOG(1) << ENDPOINT << "Created flow controller for stream " << id_ |
34 << ", setting initial receive window offset to: " | 34 << ", setting initial receive window offset to: " |
35 << receive_window_offset_ | 35 << receive_window_offset_ |
36 << ", max receive window to: " | 36 << ", max receive window to: " |
37 << max_receive_window_ | 37 << max_receive_window_ |
38 << ", setting send window offset to: " << send_window_offset_; | 38 << ", setting send window offset to: " << send_window_offset_; |
39 if (connection_->version() <= QUIC_VERSION_16) { | |
40 DVLOG(1) << ENDPOINT << "Disabling QuicFlowController for stream " << id_ | |
41 << ", QUIC version " << connection_->version(); | |
42 Disable(); | |
43 } | |
44 } | 39 } |
45 | 40 |
46 void QuicFlowController::AddBytesConsumed(uint64 bytes_consumed) { | 41 void QuicFlowController::AddBytesConsumed(uint64 bytes_consumed) { |
47 if (!IsEnabled()) { | 42 if (!IsEnabled()) { |
48 return; | 43 return; |
49 } | 44 } |
50 | 45 |
51 bytes_consumed_ += bytes_consumed; | 46 bytes_consumed_ += bytes_consumed; |
52 DVLOG(1) << ENDPOINT << "Stream " << id_ << " consumed: " << bytes_consumed_; | 47 DVLOG(1) << ENDPOINT << "Stream " << id_ << " consumed: " << bytes_consumed_; |
53 | 48 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 182 } |
188 | 183 |
189 uint64 QuicFlowController::SendWindowSize() const { | 184 uint64 QuicFlowController::SendWindowSize() const { |
190 if (bytes_sent_ > send_window_offset_) { | 185 if (bytes_sent_ > send_window_offset_) { |
191 return 0; | 186 return 0; |
192 } | 187 } |
193 return send_window_offset_ - bytes_sent_; | 188 return send_window_offset_ - bytes_sent_; |
194 } | 189 } |
195 | 190 |
196 } // namespace net | 191 } // namespace net |
OLD | NEW |