From 729c591b03697489a6af48aa5083c738e504f370 Mon Sep 17 00:00:00 2001 From: Pixelstorm Date: Sat, 6 Apr 2024 17:00:37 +0100 Subject: [PATCH] Add sync bounds to traits --- quinn-proto/src/cid_generator.rs | 2 +- quinn-proto/src/congestion.rs | 2 +- quinn-proto/src/crypto.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/quinn-proto/src/cid_generator.rs b/quinn-proto/src/cid_generator.rs index 0b7f502d3a..2b36cd86ba 100644 --- a/quinn-proto/src/cid_generator.rs +++ b/quinn-proto/src/cid_generator.rs @@ -6,7 +6,7 @@ use crate::shared::ConnectionId; use crate::MAX_CID_SIZE; /// Generates connection IDs for incoming connections -pub trait ConnectionIdGenerator: Send { +pub trait ConnectionIdGenerator: Send + Sync { /// Generates a new CID /// /// Connection IDs MUST NOT contain any information that can be used by diff --git a/quinn-proto/src/congestion.rs b/quinn-proto/src/congestion.rs index ec6bde82c8..fac6e80e51 100644 --- a/quinn-proto/src/congestion.rs +++ b/quinn-proto/src/congestion.rs @@ -14,7 +14,7 @@ pub use cubic::{Cubic, CubicConfig}; pub use new_reno::{NewReno, NewRenoConfig}; /// Common interface for different congestion controllers -pub trait Controller: Send { +pub trait Controller: Send + Sync { /// One or more packets were just sent #[allow(unused_variables)] fn on_sent(&mut self, now: Instant, bytes: u64, last_packet_number: u64) {} diff --git a/quinn-proto/src/crypto.rs b/quinn-proto/src/crypto.rs index 3c2cb5c04d..b2d5afdcbb 100644 --- a/quinn-proto/src/crypto.rs +++ b/quinn-proto/src/crypto.rs @@ -25,7 +25,7 @@ pub(crate) mod ring; pub mod rustls; /// A cryptographic session (commonly TLS) -pub trait Session: Send + 'static { +pub trait Session: Send + Sync + 'static { /// Create the initial set of keys given the client's initial destination ConnectionId fn initial_keys(&self, dst_cid: &ConnectionId, side: Side) -> Keys; @@ -146,7 +146,7 @@ pub trait ServerConfig: Send + Sync { } /// Keys used to protect packet payloads -pub trait PacketKey: Send { +pub trait PacketKey: Send + Sync { /// Encrypt the packet payload with the given packet number fn encrypt(&self, packet: u64, buf: &mut [u8], header_len: usize); /// Decrypt the packet payload with the given packet number @@ -166,7 +166,7 @@ pub trait PacketKey: Send { } /// Keys used to protect packet headers -pub trait HeaderKey: Send { +pub trait HeaderKey: Send + Sync { /// Decrypt the given packet's header fn decrypt(&self, pn_offset: usize, packet: &mut [u8]); /// Encrypt the given packet's header