From fc0aae82e8528faa35548547ef7799e565eca051 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Wed, 16 Oct 2024 20:33:12 +0000 Subject: [PATCH] only set the value larger than 0 Signed-off-by: Dan Zhang --- api/envoy/config/core/v3/protocol.proto | 7 ++----- mobile/library/cc/engine_builder.cc | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/api/envoy/config/core/v3/protocol.proto b/api/envoy/config/core/v3/protocol.proto index 621030f9b825..d8ce3cd817c0 100644 --- a/api/envoy/config/core/v3/protocol.proto +++ b/api/envoy/config/core/v3/protocol.proto @@ -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 `. And the probes afterwards will always use :ref:`max_interval `. // // The value should be smaller than :ref:`connection 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 ` 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 ` 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} diff --git a/mobile/library/cc/engine_builder.cc b/mobile/library/cc/engine_builder.cc index b34d8c424450..59d35c3a495a 100644 --- a/mobile/library/cc/engine_builder.cc +++ b/mobile/library/cc/engine_builder.cc @@ -756,8 +756,10 @@ std::unique_ptr 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())