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

Unified Diff: net/quic/quic_session.cc

Issue 1327903004: relnote: QUIC bugfix (and test) for setting smaller receive window size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Add_num_connections_101619602
Patch Set: Created 5 years, 3 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/tools/quic/end_to_end_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 8e3696ba07d6648f3fbbc94d8e5ccb2892576c8d..c2e2f2b707313a340f453a5127d2c7ae3da432d2 100644
--- a/net/quic/quic_session.cc
+++ b/net/quic/quic_session.cc
@@ -425,20 +425,19 @@ void QuicSession::OnConfigNegotiated() {
if (config_.HasReceivedConnectionOptions()) {
if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kAFCW)) {
+ // The following variations change the initial receive flow control
+ // window sizes.
+ if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW5)) {
+ AdjustInitialFlowControlWindows(32 * 1024);
+ }
+ if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW6)) {
+ AdjustInitialFlowControlWindows(64 * 1024);
+ }
+ if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW7)) {
+ AdjustInitialFlowControlWindows(128 * 1024);
+ }
EnableAutoTuneReceiveWindow();
}
- // The following variations change the initial receive flow control window
- // size for streams. For simplicity reasons, do not try to effect
- // existing streams but only future ones.
- if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW5)) {
- config_.SetInitialStreamFlowControlWindowToSend(32 * 1024);
- }
- if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW6)) {
- config_.SetInitialStreamFlowControlWindowToSend(64 * 1024);
- }
- if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW7)) {
- config_.SetInitialStreamFlowControlWindowToSend(128 * 1024);
- }
}
}
set_max_open_streams(max_streams);
@@ -456,6 +455,7 @@ void QuicSession::OnConfigNegotiated() {
}
void QuicSession::EnableAutoTuneReceiveWindow() {
+ DVLOG(1) << ENDPOINT << "Enable auto tune receive windows";
flow_controller_.set_auto_tune_receive_window(true);
// Inform all existing streams about the new window.
for (auto const& kv : static_stream_map_) {
@@ -466,6 +466,33 @@ void QuicSession::EnableAutoTuneReceiveWindow() {
}
}
+void QuicSession::AdjustInitialFlowControlWindows(size_t stream_window) {
+ const float session_window_multiplier =
+ config_.GetInitialStreamFlowControlWindowToSend()
+ ? static_cast<float>(
+ config_.GetInitialSessionFlowControlWindowToSend()) /
+ config_.GetInitialStreamFlowControlWindowToSend()
+ : 1.0;
+ DVLOG(1) << ENDPOINT << "Set stream receive window to " << stream_window;
+ config_.SetInitialStreamFlowControlWindowToSend(stream_window);
+ // Reduce the session window as well, motivation is reducing resource waste
+ // and denial of service vulnerability, as with the stream window. Session
+ // size is set according to the ratio between session and stream window size
+ // previous to auto-tuning. Note that the ratio may change dynamically, since
+ // auto-tuning acts independently for each flow controller.
+ size_t session_window = session_window_multiplier * stream_window;
+ DVLOG(1) << ENDPOINT << "Set session receive window to " << session_window;
+ config_.SetInitialSessionFlowControlWindowToSend(session_window);
+ flow_controller_.UpdateReceiveWindowSize(session_window);
+ // Inform all existing streams about the new window.
+ for (auto const& kv : static_stream_map_) {
+ kv.second->flow_controller()->UpdateReceiveWindowSize(stream_window);
+ }
+ for (auto const& kv : dynamic_stream_map_) {
+ kv.second->flow_controller()->UpdateReceiveWindowSize(stream_window);
+ }
+}
+
void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window) {
if (new_window < kMinimumFlowControlSendWindow) {
LOG(ERROR) << "Peer sent us an invalid stream flow control send window: "
« no previous file with comments | « net/quic/quic_session.h ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698