Skip to content

Commit

Permalink
Fixed broken code behind feature flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
horned-sphere committed Jun 26, 2024
1 parent 7eac2ce commit a993d3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions runtime/swimos_remote/src/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ impl CryptoProviderConfig {
CryptoProviderConfig::FromFeatureFlags => {
#[cfg(all(feature = "ring_provider", not(feature = "aws_lc_rs_provider")))]
{
return Arc::new(rustls::crypto::ring::default_provider());
return Ok(Arc::new(rustls::crypto::ring::default_provider()));
}

#[cfg(all(feature = "aws_lc_rs_provider", not(feature = "ring_provider")))]
{
return Arc::new(rustls::crypto::aws_lc_rs::default_provider());
return Ok(Arc::new(rustls::crypto::aws_lc_rs::default_provider()));
}

#[allow(unreachable_code)]
Expand Down
16 changes: 7 additions & 9 deletions swimos_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ use std::time::Duration;
use std::{marker::PhantomData, num::NonZeroUsize, sync::Arc};

use futures_util::future::BoxFuture;
use ratchet::{
deflate::{DeflateConfig, DeflateExtProvider},
WebSocketStream,
};
use ratchet::WebSocketStream;
use rustls::crypto::CryptoProvider;

pub use commander::{CommandError, Commander};
Expand Down Expand Up @@ -71,7 +68,7 @@ const DEFAULT_CLOSE_TIMEOUT: Duration = Duration::from_secs(5);
pub struct WebSocketConfig {
pub max_message_size: usize,
#[cfg(feature = "deflate")]
pub deflate_config: Option<DeflateConfig>,
pub deflate_config: Option<ratchet::DeflateConfig>,
}

impl Default for WebSocketConfig {
Expand Down Expand Up @@ -137,7 +134,7 @@ impl SwimClientBuilder {

/// Sets the deflate extension configuration for WebSocket connections.
#[cfg(feature = "deflate")]
pub fn set_deflate_config(mut self, to: DeflateConfig) -> SwimClientBuilder {
pub fn set_deflate_config(mut self, to: ratchet::DeflateConfig) -> SwimClientBuilder {
self.client_config.websocket.deflate_config = Some(to);
self
}
Expand Down Expand Up @@ -229,8 +226,9 @@ where
max_message_size: websocket.max_message_size,
});

let provider =
DeflateExtProvider::with_config(websocket.deflate_config.unwrap_or_default());
let provider = ratchet::DeflateExtProvider::with_config(
websocket.deflate_config.unwrap_or_default(),
);

start_runtime(
registration_buffer_size,
Expand Down Expand Up @@ -258,7 +256,7 @@ where
Transport::new(
networking,
websockets,
NoExtProvider,
ratchet::NoExtProvider,
remote_buffer_size,
close_timeout,
),
Expand Down

0 comments on commit a993d3e

Please sign in to comment.