From ca8d6e981a63a7ef911bb19ccf779be9743f0454 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Thu, 29 Jun 2023 15:02:38 +0100 Subject: simplify ConnectionId Currently a ConnectionId can either be a slice or a Vec. Because of this declarations might need to also declare an explicit lifetime, which make using the struct slightly annoying. Instead just use a Vec all the time, and to avoid wasting memory when cloning (since the CIDs are read-only anyway), wrap the internal Vec in an Arc. --- apps/src/common.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/src/common.rs') diff --git a/apps/src/common.rs b/apps/src/common.rs index e58e4a01..6f4fc83c 100644 --- a/apps/src/common.rs +++ b/apps/src/common.rs @@ -100,7 +100,7 @@ pub struct Client { pub max_send_burst: usize, } -pub type ClientIdMap = HashMap, ClientId>; +pub type ClientIdMap = HashMap; pub type ClientMap = HashMap; /// Makes a buffered writer for a resource with a target URL. @@ -255,7 +255,7 @@ pub fn hdrs_to_strings(hdrs: &[quiche::h3::Header]) -> Vec<(String, String)> { /// Generate a new pair of Source Connection ID and reset token. pub fn generate_cid_and_reset_token( rng: &T, -) -> (quiche::ConnectionId<'static>, u128) { +) -> (quiche::ConnectionId, u128) { let mut scid = [0; quiche::MAX_CONN_ID_LEN]; rng.fill(&mut scid).unwrap(); let scid = scid.to_vec().into(); -- cgit v1.2.3