diff --git a/cobalt/network/switches.cc b/cobalt/network/switches.cc index eff2b39135ea..6d8ba1b0091a 100644 --- a/cobalt/network/switches.cc +++ b/cobalt/network/switches.cc @@ -55,6 +55,13 @@ const char kMaxNetworkDelayHelp[] = const char kDisableInAppDial[] = "disable_in_app_dial"; const char kDisableInAppDialHelp[] = "Disable the in-app dial server."; +const char kQuicConnectionOptions[] = "quic_connection_options"; +const char kQuicConnectionOptionsHelp[] = "Specify QUIC connection options."; + +const char kQuicClientConnectionOptions[] = "quic_client_connection_options."; +const char kQuicClientConnectionOptionsHelp[] = + "Specify QUIC client connection options"; + #endif // ENABLE_DEBUG_COMMAND_LINE_SWITCHES const char kDisableQuic[] = "disable_quic"; @@ -72,6 +79,8 @@ std::map HelpMap() { {kNetLogCaptureMode, kNetLogCaptureModeHelp}, {kUserAgent, kUserAgentHelp}, {kDisableInAppDial, kDisableInAppDialHelp}, + {kQuicConnectionOptions, kQuicConnectionOptionsHelp}, + {kQuicClientConnectionOptions, kQuicClientConnectionOptionsHelp}, #endif // !defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES) {kDisableQuic, kDisableQuicHelp}, {kDisableHttp2, kDisableHttp2Help}, diff --git a/cobalt/network/switches.h b/cobalt/network/switches.h index c4880bb7ea8e..ac026dd88dda 100644 --- a/cobalt/network/switches.h +++ b/cobalt/network/switches.h @@ -29,6 +29,8 @@ extern const char kUserAgent[]; extern const char kMaxNetworkDelay[]; extern const char kMaxNetworkDelayHelp[]; extern const char kDisableInAppDial[]; +extern const char kQuicConnectionOptions[]; +extern const char kQuicClientConnectionOptions[]; #endif // ENABLE_DEBUG_COMMAND_LINE_SWITCHES extern const char kDisableQuic[]; extern const char kDisableHttp2[]; diff --git a/cobalt/network/url_request_context.cc b/cobalt/network/url_request_context.cc index 666cf4fe8b06..1301d327a151 100644 --- a/cobalt/network/url_request_context.cc +++ b/cobalt/network/url_request_context.cc @@ -54,6 +54,7 @@ #include "net/quic/quic_context.h" #include "net/ssl/ssl_config_service.h" #include "net/ssl/ssl_config_service_defaults.h" +#include "net/third_party/quiche/src/quiche/quic/core/quic_tag.h" #include "starboard/common/murmurhash2.h" #include "starboard/configuration_constants.h" @@ -207,9 +208,25 @@ URLRequestContext::URLRequestContext( auto quic_context = std::make_unique(); quic_context->params()->supported_versions = quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::Q046()}; - url_request_context_builder->set_quic_context(std::move(quic_context)); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + + std::string quic_connection_options = + command_line->GetSwitchValueASCII(switches::kQuicConnectionOptions); + if (!quic_connection_options.empty()) { + quic_context->params()->connection_options = + quic::ParseQuicTagVector(quic_connection_options); + } + + std::string quic_client_connection_options = + command_line->GetSwitchValueASCII(switches::kQuicClientConnectionOptions); + if (!quic_connection_options.empty()) { + quic_context->params()->client_connection_options = + quic::ParseQuicTagVector(quic_client_connection_options); + } + + url_request_context_builder->set_quic_context(std::move(quic_context)); + bool quic_enabled = configuration::Configuration::GetInstance()->CobaltEnableQuic() && !command_line->HasSwitch(switches::kDisableQuic); diff --git a/net/third_party/quiche/src/quiche/quic/core/quic_constants.h b/net/third_party/quiche/src/quiche/quic/core/quic_constants.h index dfd908e92eb6..8fa38753a7d2 100644 --- a/net/third_party/quiche/src/quiche/quic/core/quic_constants.h +++ b/net/third_party/quiche/src/quiche/quic/core/quic_constants.h @@ -294,8 +294,8 @@ inline constexpr int kDefaultIetfLossDelayShift = 3; // Maximum number of retransmittable packets received before sending an ack. inline constexpr QuicPacketCount kDefaultRetransmittablePacketsBeforeAck = 2; -// Wait for up to 10 retransmittable packets before sending an ack. -inline constexpr QuicPacketCount kMaxRetransmittablePacketsBeforeAck = 10; +// Wait for up to 50 retransmittable packets before sending an ack. +inline constexpr QuicPacketCount kMaxRetransmittablePacketsBeforeAck = 50; // Minimum number of packets received before ack decimation is enabled. // This intends to avoid the beginning of slow start, when CWNDs may be // rapidly increasing.