Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index 6d749ec1fbeec599205908ccde20d1aecfae7687..512044f9fb4e15b20751010060ff67fa004897f7 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -8,6 +8,7 @@ |
#include "net/quic/crypto/proof_verifier.h" |
#include "net/quic/quic_connection.h" |
#include "net/quic/quic_flags.h" |
+#include "net/quic/quic_flow_controller.h" |
#include "net/quic/quic_headers_stream.h" |
#include "net/ssl/ssl_info.h" |
@@ -95,6 +96,7 @@ class VisitorShim : public QuicConnectionVisitorInterface { |
}; |
QuicSession::QuicSession(QuicConnection* connection, |
+ uint32 max_flow_control_receive_window_bytes, |
const QuicConfig& config) |
: connection_(connection), |
visitor_shim_(new VisitorShim(this)), |
@@ -105,7 +107,20 @@ QuicSession::QuicSession(QuicConnection* connection, |
error_(QUIC_NO_ERROR), |
goaway_received_(false), |
goaway_sent_(false), |
- has_pending_handshake_(false) { |
+ has_pending_handshake_(false), |
+ max_flow_control_receive_window_bytes_( |
+ max_flow_control_receive_window_bytes) { |
+ if (max_flow_control_receive_window_bytes_ < kDefaultFlowControlSendWindow) { |
+ LOG(ERROR) << "Initial receive window (" |
+ << max_flow_control_receive_window_bytes_ |
+ << ") cannot be set lower than default (" |
+ << kDefaultFlowControlSendWindow << ")."; |
+ max_flow_control_receive_window_bytes_ = kDefaultFlowControlSendWindow; |
+ } |
+ flow_controller_.reset(new QuicFlowController( |
+ connection_->supported_versions().front(), 0, is_server(), |
+ kDefaultFlowControlSendWindow, max_flow_control_receive_window_bytes_, |
+ max_flow_control_receive_window_bytes_)); |
connection_->set_visitor(visitor_shim_.get()); |
connection_->SetFromConfig(config_); |
@@ -229,8 +244,7 @@ void QuicSession::OnWindowUpdateFrames( |
<< "Received connection level flow control window update with " |
"byte offset: " << frames[i].byte_offset; |
if (FLAGS_enable_quic_connection_flow_control && |
- connection()->flow_controller()->UpdateSendWindowOffset( |
- frames[i].byte_offset)) { |
+ flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { |
connection_window_updated = true; |
} |
continue; |
@@ -399,8 +413,7 @@ void QuicSession::OnConfigNegotiated() { |
} |
// Update connection level window. |
- connection()->flow_controller()->UpdateSendWindowOffset( |
- new_flow_control_send_window); |
+ flow_controller_->UpdateSendWindowOffset(new_flow_control_send_window); |
} |
} |
@@ -605,4 +618,10 @@ void QuicSession::PostProcessAfterData() { |
closed_streams_.clear(); |
} |
+void QuicSession::OnSuccessfulVersionNegotiation(const QuicVersion& version) { |
+ if (version < QUIC_VERSION_19) { |
+ flow_controller_->Disable(); |
+ } |
+} |
+ |
} // namespace net |