Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rustls provider to be cloned and take in Arcs #1641

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions quic/s2n-quic-rustls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use s2n_codec::EncoderValue;
use s2n_quic_core::{application::ServerName, crypto::tls};
use std::sync::Arc;

#[derive(Clone)]
pub struct Client {
config: Arc<ClientConfig>,
}
Expand Down Expand Up @@ -39,6 +40,12 @@ impl From<ClientConfig> for Client {
}
}

impl From<Arc<ClientConfig>> for Client {
fn from(config: Arc<ClientConfig>) -> Self {
Self { config }
}
}

impl tls::Endpoint for Client {
type Session = Session;

Expand Down
7 changes: 7 additions & 0 deletions quic/s2n-quic-rustls/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use s2n_codec::EncoderValue;
use s2n_quic_core::{application::ServerName, crypto::tls};
use std::sync::Arc;

#[derive(Clone)]
pub struct Server {
config: Arc<ServerConfig>,
}
Expand Down Expand Up @@ -37,6 +38,12 @@ impl From<ServerConfig> for Server {
}
}

impl From<Arc<ServerConfig>> for Server {
fn from(config: Arc<ServerConfig>) -> Self {
Self { config }
}
}

impl tls::Endpoint for Server {
type Session = Session;

Expand Down