Skip to content

Commit

Permalink
Add quic connection options, lift ack decimation to 50
Browse files Browse the repository at this point in the history
  • Loading branch information
jellefoks committed Dec 14, 2024
1 parent 434ecd1 commit 38642db
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
9 changes: 9 additions & 0 deletions cobalt/network/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -72,6 +79,8 @@ std::map<std::string, const char*> HelpMap() {
{kNetLogCaptureMode, kNetLogCaptureModeHelp},
{kUserAgent, kUserAgentHelp},
{kDisableInAppDial, kDisableInAppDialHelp},
{kQuicConnectionOptions, kQuicConnectionOptionsHelp},
{kQuicClientConnectionOptions, kQuicClientConnectionOptionsHelp},
#endif // !defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
{kDisableQuic, kDisableQuicHelp},
{kDisableHttp2, kDisableHttp2Help},
Expand Down
2 changes: 2 additions & 0 deletions cobalt/network/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
19 changes: 18 additions & 1 deletion cobalt/network/url_request_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -207,9 +208,25 @@ URLRequestContext::URLRequestContext(
auto quic_context = std::make_unique<net::QuicContext>();
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);
Expand Down
4 changes: 2 additions & 2 deletions net/third_party/quiche/src/quiche/quic/core/quic_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 38642db

Please sign in to comment.