From b5b7dddf6a2d02545a24690e638bf33965e24076 Mon Sep 17 00:00:00 2001 From: Masahiro Kozuka Date: Wed, 1 Jan 2025 17:05:16 +0900 Subject: [PATCH] Add preview API feature with additional settings and methods --- Cargo.toml | 1 + src/lib.rs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 031eea7812..ad41247b71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ include = [ [features] default = [] static = [] +preview-api = [] [build-dependencies] cmake = "0.1" diff --git a/src/lib.rs b/src/lib.rs index 34a1b1cc76..7e4d369ac0 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -826,6 +826,7 @@ pub struct Settings { pub mtu_operations_per_drain: u8, pub mtu_discovery_missing_probe_count: u8, pub dest_cid_update_idle_timeout_ms: u32, + pub other2_flags: u64, } pub const PARAM_GLOBAL_RETRY_MEMORY_PERCENT: u32 = 0x01000000; @@ -1350,6 +1351,12 @@ impl Settings { self.other_flags |= (value as u8) << 3; self } + #[cfg(feature = "preview-api")] + pub fn set_stream_multi_receive_enabled(&mut self, value: bool) -> &mut Settings { + self.is_set_flags |= 1 << 42; + self.other2_flags |= (value as u64) << 5; + self + } } impl CredentialConfig { @@ -1958,9 +1965,15 @@ fn test_module() { let res = Configuration::new( ®istration, &alpn, + #[cfg(feature = "preview-api")] + Settings::new() + .set_peer_bidi_stream_count(100) + .set_peer_unidi_stream_count(3) + .set_stream_multi_receive_enabled(true), + #[cfg(not(feature = "preview-api"))] Settings::new() .set_peer_bidi_stream_count(100) - .set_peer_unidi_stream_count(3), + .set_peer_unidi_stream_count(3) ); assert!( res.is_ok(),