aboutsummaryrefslogtreecommitdiff
path: root/apps/src/common.rs
diff options
context:
space:
mode:
authorGravatar Alessandro Ghedini <alessandro@ghedini.me> 2023-06-29 15:02:38 +0100
committerGravatar Alessandro Ghedini <alessandro@ghedini.me> 2023-06-29 16:20:09 +0100
commitca8d6e981a63a7ef911bb19ccf779be9743f0454 (patch)
tree794ee17162b52ced4d81c2b96ab7e93692c8ae66 /apps/src/common.rs
parentd1662fb0dafebb536968ba445a94f7ba80d68e55 (diff)
downloadquiche-cid-arc.tar.gz
quiche-cid-arc.tar.zst
quiche-cid-arc.zip
simplify ConnectionIdcid-arc
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.
Diffstat (limited to 'apps/src/common.rs')
-rw-r--r--apps/src/common.rs4
1 files changed, 2 insertions, 2 deletions
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<ConnectionId<'static>, ClientId>;
+pub type ClientIdMap = HashMap<ConnectionId, ClientId>;
pub type ClientMap = HashMap<ClientId, Client>;
/// 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<T: SecureRandom>(
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();