From 81c614225508dcda2641a6a7012bc92a774d06d9 Mon Sep 17 00:00:00 2001 From: Ali Beyad Date: Fri, 26 Apr 2024 18:41:00 -0400 Subject: [PATCH] mobile: Add the ability to set the stream idle timeout in Cronvoy (#33827) Signed-off-by: Ali Beyad --- .../net/impl/NativeCronvoyEngineBuilderImpl.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mobile/library/java/org/chromium/net/impl/NativeCronvoyEngineBuilderImpl.java b/mobile/library/java/org/chromium/net/impl/NativeCronvoyEngineBuilderImpl.java index b72441e6be8d..243c64df08d2 100644 --- a/mobile/library/java/org/chromium/net/impl/NativeCronvoyEngineBuilderImpl.java +++ b/mobile/library/java/org/chromium/net/impl/NativeCronvoyEngineBuilderImpl.java @@ -53,7 +53,7 @@ public class NativeCronvoyEngineBuilderImpl extends CronvoyEngineBuilderImpl { private final int mH2ConnectionKeepaliveIdleIntervalMilliseconds = 1; private final int mH2ConnectionKeepaliveTimeoutSeconds = 10; private final int mMaxConnectionsPerHost = 7; - private final int mStreamIdleTimeoutSeconds = 15; + private int mStreamIdleTimeoutSeconds = 15; private final int mPerTryIdleTimeoutSeconds = 15; private final String mAppVersion = "unspecified"; private final String mAppId = "unspecified"; @@ -111,6 +111,19 @@ public NativeCronvoyEngineBuilderImpl setMinDnsRefreshSeconds(int minRefreshSeco return this; } + /** + * Set the stream idle timeout, in seconds, which is defined as the period in which there are no + * active requests. When the idle timeout is reached, the connection is closed. + * + * The default is 15s. + * + * @param timeout The stream idle timeout, in seconds. + */ + public NativeCronvoyEngineBuilderImpl setStreamIdleTimeoutSeconds(int timeout) { + mStreamIdleTimeoutSeconds = timeout; + return this; + } + /** * Sets the boolean value for the reloadable runtime feature flag value. For example, to set the * Envoy runtime flag `envoy.reloadable_features.http_allow_partial_urls_in_referer` to true,