Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Unified Diff: net/quic/quic_session.cc

Issue 286213002: Refactor: move flow controller from QuicConnection to QuicSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698