Skip to content

Commit

Permalink
Add sync bounds to traits
Browse files Browse the repository at this point in the history
  • Loading branch information
BigWingBeat committed Apr 9, 2024
1 parent 6d8203d commit 729c591
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion quinn-proto/src/cid_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion quinn-proto/src/congestion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
6 changes: 3 additions & 3 deletions quinn-proto/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 729c591

Please sign in to comment.