Skip to content

Commit

Permalink
only set the value larger than 0
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Zhang <danzh@google.com>
  • Loading branch information
danzh1989 committed Oct 16, 2024
1 parent 059cb64 commit fc0aae8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 2 additions & 5 deletions api/envoy/config/core/v3/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ message QuicKeepAliveSettings {
//
// If zero, disable keepalive probing.
// If absent, use the QUICHE default interval to probe.
google.protobuf.Duration max_interval = 1 [(validate.rules).duration = {
lte {}
gte {seconds: 1}
}];
google.protobuf.Duration max_interval = 1;

// The interval to send the first few keep-alive probing packets to prevent connection from hitting the idle timeout. Subsequent probes will be sent, each one with an interval exponentially longer than previous one, till it reaches :ref:`max_interval <envoy_v3_api_field_config.core.v3.QuicKeepAliveSettings.max_interval>`. And the probes afterwards will always use :ref:`max_interval <envoy_v3_api_field_config.core.v3.QuicKeepAliveSettings.max_interval>`.
//
// The value should be smaller than :ref:`connection idle_timeout <envoy_v3_api_field_config.listener.v3.QuicProtocolOptions.idle_timeout>` to prevent idle timeout and smaller than max_interval to take effect.
//
// If absent or zero, disable keepalive probing for a server connection. For a client connection, if :ref:`max_interval <envoy_v3_api_field_config.core.v3.QuicKeepAliveSettings.max_interval>` is also zero, do not keepalive, otherwise use max_interval or QUICHE default to probe all the time.
// If absent, disable keepalive probing for a server connection. For a client connection, if :ref:`max_interval <envoy_v3_api_field_config.core.v3.QuicKeepAliveSettings.max_interval>` is zero, do not keepalive, otherwise use max_interval or QUICHE default to probe all the time.
google.protobuf.Duration initial_interval = 2 [(validate.rules).duration = {
lte {}
gte {nanos: 1000000}
Expand Down
6 changes: 4 additions & 2 deletions mobile/library/cc/engine_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,10 @@ std::unique_ptr<envoy::config::bootstrap::v3::Bootstrap> EngineBuilder::generate
auto* quic_protocol_options = alpn_options.mutable_auto_config()
->mutable_http3_protocol_options()
->mutable_quic_protocol_options();
quic_protocol_options->mutable_connection_keepalive()->mutable_initial_interval()->set_nanos(
keepalive_initial_interval_ms_ * 1000 * 1000);
if (keepalive_initial_interval_ms_ > 0) {
quic_protocol_options->mutable_connection_keepalive()->mutable_initial_interval()->set_nanos(
keepalive_initial_interval_ms_ * 1000 * 1000);
}

base_cluster->mutable_transport_socket()->mutable_typed_config()->PackFrom(h3_proxy_socket);
(*base_cluster->mutable_typed_extension_protocol_options())
Expand Down

0 comments on commit fc0aae8

Please sign in to comment.