diff --git a/protocol/library/src/client.rs b/protocol/library/src/client.rs index eadafad..09e7ed1 100644 --- a/protocol/library/src/client.rs +++ b/protocol/library/src/client.rs @@ -55,21 +55,18 @@ impl Default for GurtClientConfig { #[derive(Debug)] enum Connection { Plain(TcpStream), - Tls(tokio_rustls::client::TlsStream), } impl Connection { async fn read(&mut self, buf: &mut [u8]) -> Result { match self { Connection::Plain(stream) => stream.read(buf).await.map_err(|e| GurtError::connection(e.to_string())), - Connection::Tls(stream) => stream.read(buf).await.map_err(|e| GurtError::connection(e.to_string())), } } async fn write_all(&mut self, buf: &[u8]) -> Result<()> { match self { Connection::Plain(stream) => stream.write_all(buf).await.map_err(|e| GurtError::connection(e.to_string())), - Connection::Tls(stream) => stream.write_all(buf).await.map_err(|e| GurtError::connection(e.to_string())), } } } @@ -83,10 +80,6 @@ impl PooledConnection { fn new(stream: TcpStream) -> Self { Self { connection: Connection::Plain(stream) } } - - fn with_tls(stream: tokio_rustls::client::TlsStream) -> Self { - Self { connection: Connection::Tls(stream) } - } } pub struct GurtClient { @@ -259,7 +252,6 @@ impl GurtClient { let tcp_stream = match plain_conn.connection { Connection::Plain(stream) => stream, - _ => return Err(GurtError::protocol("Expected plain connection for handshake")), }; self.upgrade_to_tls(tcp_stream, host).await diff --git a/protocol/library/src/server.rs b/protocol/library/src/server.rs index 83fc5bd..42f940a 100644 --- a/protocol/library/src/server.rs +++ b/protocol/library/src/server.rs @@ -7,7 +7,7 @@ use crate::{ }; use tokio::net::{TcpListener, TcpStream}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; -use tokio::time::{timeout, Duration}; +use tokio::time::Duration; use tokio_rustls::{TlsAcceptor, server::TlsStream}; use rustls::pki_types::CertificateDer; use std::collections::HashMap;