From bb8a2428123a192cf49c649a3d029d09c58cd814 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Thu, 1 Oct 2026 15:14:57 +0900 Subject: [PATCH] feat(connection): expose whether peer settings have been received --- src/client.rs | 11 +++++++++++ src/proto/connection.rs | 6 ++++++ src/proto/settings.rs | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/src/client.rs b/src/client.rs index 9d0ff31d9..d0f9c7bbe 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1432,6 +1432,17 @@ where self.inner.take_user_pings().map(PingPong::new) } + /// Returns whether the initial `SETTINGS` frame from the server peer has + /// been received and applied. + /// + /// Until then, [`max_concurrent_send_streams`][Self::max_concurrent_send_streams] + /// reflects the locally configured + /// [`initial_max_send_streams`][Builder::initial_max_send_streams] rather + /// than the server's limit. + pub fn has_received_initial_settings(&self) -> bool { + self.inner.has_received_remote_initial_settings() + } + /// Returns the maximum number of concurrent streams that may be initiated /// by this client. /// diff --git a/src/proto/connection.rs b/src/proto/connection.rs index bb72d6068..7081d2a46 100644 --- a/src/proto/connection.rs +++ b/src/proto/connection.rs @@ -194,6 +194,12 @@ where self.inner.settings.send_settings(settings) } + /// Returns whether the initial SETTINGS frame from the remote peer has + /// been received and applied. + pub(crate) fn has_received_remote_initial_settings(&self) -> bool { + self.inner.settings.has_received_remote_initial_settings() + } + /// Returns the maximum number of concurrent streams that may be initiated /// by this peer. pub(crate) fn max_send_streams(&self) -> usize { diff --git a/src/proto/settings.rs b/src/proto/settings.rs index d6155fc3d..2a0dc1cfb 100644 --- a/src/proto/settings.rs +++ b/src/proto/settings.rs @@ -99,6 +99,12 @@ impl Settings { } } + /// Returns `true` once the initial SETTINGS frame from the remote peer + /// has been received and applied. + pub(crate) fn has_received_remote_initial_settings(&self) -> bool { + self.has_received_remote_initial_settings + } + /// Sets `true` to `self.has_received_remote_initial_settings`. /// Returns `true` if this method is called for the first time. /// (i.e. it is the initial SETTINGS frame from the remote peer)