Use a field trial to decide if QUIC should attempt to prevent packet fragmentation.
BUG=641791 Review-Url: https://codereview.chromium.org/2283393002 Cr-Commit-Position: refs/heads/master@{#415385}
This commit is contained in:
components/network_session_configurator
net
@ -226,6 +226,13 @@ bool ShouldQuicRaceCertVerification(
|
||||
"true");
|
||||
}
|
||||
|
||||
bool ShouldQuicDoNotFragment(
|
||||
const VariationParameters& quic_trial_params) {
|
||||
return base::LowerCaseEqualsASCII(
|
||||
GetVariationParam(quic_trial_params, "do_not_fragment"),
|
||||
"true");
|
||||
}
|
||||
|
||||
bool ShouldQuicDisablePreConnectIfZeroRtt(
|
||||
const VariationParameters& quic_trial_params) {
|
||||
return base::LowerCaseEqualsASCII(
|
||||
@ -348,6 +355,8 @@ void ConfigureQuicParams(base::StringPiece quic_trial_group,
|
||||
}
|
||||
params->quic_race_cert_verification =
|
||||
ShouldQuicRaceCertVerification(quic_trial_params);
|
||||
params->quic_do_not_fragment =
|
||||
ShouldQuicDoNotFragment(quic_trial_params);
|
||||
params->quic_disable_preconnect_if_0rtt =
|
||||
ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params);
|
||||
params->quic_host_whitelist = GetQuicHostWhitelist(quic_trial_params);
|
||||
|
@ -83,6 +83,7 @@ TEST_F(NetworkSessionConfiguratorTest, EnableQuicFromFieldTrialGroup) {
|
||||
EXPECT_EQ(net::kQuicYieldAfterDurationMilliseconds,
|
||||
params_.quic_packet_reader_yield_after_duration_milliseconds);
|
||||
EXPECT_FALSE(params_.quic_race_cert_verification);
|
||||
EXPECT_FALSE(params_.quic_do_not_fragment);
|
||||
EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt);
|
||||
EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change);
|
||||
EXPECT_FALSE(params_.quic_migrate_sessions_early);
|
||||
@ -164,6 +165,17 @@ TEST_F(NetworkSessionConfiguratorTest, QuicRaceCertVerification) {
|
||||
EXPECT_TRUE(params_.quic_race_cert_verification);
|
||||
}
|
||||
|
||||
TEST_F(NetworkSessionConfiguratorTest, QuicDoNotFragment) {
|
||||
std::map<std::string, std::string> field_trial_params;
|
||||
field_trial_params["do_not_fragment"] = "true";
|
||||
variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params);
|
||||
base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled");
|
||||
|
||||
ParseFieldTrials();
|
||||
|
||||
EXPECT_TRUE(params_.quic_do_not_fragment);
|
||||
}
|
||||
|
||||
TEST_F(NetworkSessionConfiguratorTest, QuicDisablePreConnectIfZeroRtt) {
|
||||
std::map<std::string, std::string> field_trial_params;
|
||||
field_trial_params["disable_preconnect_if_0rtt"] = "true";
|
||||
|
@ -131,6 +131,7 @@ HttpNetworkSession::Params::Params()
|
||||
quic_disable_bidirectional_streams(false),
|
||||
quic_force_hol_blocking(false),
|
||||
quic_race_cert_verification(false),
|
||||
quic_do_not_fragment(false),
|
||||
proxy_delegate(NULL),
|
||||
enable_token_binding(false) {
|
||||
quic_supported_versions.push_back(QUIC_VERSION_35);
|
||||
@ -193,6 +194,7 @@ HttpNetworkSession::HttpNetworkSession(const Params& params)
|
||||
params.quic_allow_server_migration,
|
||||
params.quic_force_hol_blocking,
|
||||
params.quic_race_cert_verification,
|
||||
params.quic_do_not_fragment,
|
||||
params.quic_connection_options,
|
||||
params.enable_token_binding),
|
||||
spdy_session_pool_(params.host_resolver,
|
||||
|
@ -186,6 +186,8 @@ class NET_EXPORT HttpNetworkSession
|
||||
bool quic_force_hol_blocking;
|
||||
// If true, race cert verification with host resolution.
|
||||
bool quic_race_cert_verification;
|
||||
// If true, configure QUIC sockets to not fragment packets.
|
||||
bool quic_do_not_fragment;
|
||||
|
||||
ProxyDelegate* proxy_delegate;
|
||||
// Enable support for Token Binding.
|
||||
|
@ -743,6 +743,7 @@ QuicStreamFactory::QuicStreamFactory(
|
||||
bool allow_server_migration,
|
||||
bool force_hol_blocking,
|
||||
bool race_cert_verification,
|
||||
bool quic_do_not_fragment,
|
||||
const QuicTagVector& connection_options,
|
||||
bool enable_token_binding)
|
||||
: require_confirmation_(true),
|
||||
@ -800,6 +801,7 @@ QuicStreamFactory::QuicStreamFactory(
|
||||
allow_server_migration_(allow_server_migration),
|
||||
force_hol_blocking_(force_hol_blocking),
|
||||
race_cert_verification_(race_cert_verification),
|
||||
quic_do_not_fragment_(quic_do_not_fragment),
|
||||
port_seed_(random_generator_->RandUint64()),
|
||||
check_persisted_supports_quic_(true),
|
||||
has_initialized_data_(false),
|
||||
@ -1705,11 +1707,13 @@ int QuicStreamFactory::ConfigureSocket(DatagramClientSocket* socket,
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = socket->SetDoNotFragment();
|
||||
// SetDoNotFragment is not implemented on all platforms, so ignore errors.
|
||||
if (rv != OK && rv != ERR_NOT_IMPLEMENTED) {
|
||||
HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT);
|
||||
return rv;
|
||||
if (quic_do_not_fragment_) {
|
||||
rv = socket->SetDoNotFragment();
|
||||
// SetDoNotFragment is not implemented on all platforms, so ignore errors.
|
||||
if (rv != OK && rv != ERR_NOT_IMPLEMENTED) {
|
||||
HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Set a buffer large enough to contain the initial CWND's worth of packet
|
||||
|
@ -196,6 +196,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
|
||||
bool allow_server_migration,
|
||||
bool force_hol_blocking,
|
||||
bool race_cert_verification,
|
||||
bool quic_do_not_fragment,
|
||||
const QuicTagVector& connection_options,
|
||||
bool enable_token_binding);
|
||||
~QuicStreamFactory() override;
|
||||
@ -623,6 +624,9 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
|
||||
// Set if cert verification is to be raced with host resolution.
|
||||
bool race_cert_verification_;
|
||||
|
||||
// If set, configure QUIC sockets to not fragment packets.
|
||||
bool quic_do_not_fragment_;
|
||||
|
||||
// Each profile will (probably) have a unique port_seed_ value. This value
|
||||
// is used to help seed a pseudo-random number generator (PortSuggester) so
|
||||
// that we consistently (within this profile) suggest the same ephemeral
|
||||
|
@ -362,7 +362,7 @@ class QuicStreamFactoryTestBase {
|
||||
packet_reader_yield_after_duration_milliseconds_,
|
||||
migrate_sessions_on_network_change_, migrate_sessions_early_,
|
||||
allow_server_migration_, force_hol_blocking_, race_cert_verification_,
|
||||
QuicTagVector(),
|
||||
/*do_not_fragment*/ true, QuicTagVector(),
|
||||
/*enable_token_binding*/ false));
|
||||
factory_->set_require_confirmation(false);
|
||||
EXPECT_FALSE(factory_->has_quic_server_info_factory());
|
||||
|
Reference in New Issue
Block a user