From 266cc9e754a782f8c46f28e18d02f3f8f4fee614 Mon Sep 17 00:00:00 2001 From: rkrishn7 Date: Mon, 1 Apr 2024 20:58:08 -0700 Subject: [PATCH] box enum variant --- src/kiwi/src/tls.rs | 2 +- src/kiwi/src/ws.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kiwi/src/tls.rs b/src/kiwi/src/tls.rs index 3d110f8..825db3d 100644 --- a/src/kiwi/src/tls.rs +++ b/src/kiwi/src/tls.rs @@ -34,7 +34,7 @@ pub fn tls_acceptor(cert: impl AsRef, key: impl AsRef) -> anyhow::Re pub enum MaybeTlsStream { Plain(S), - Tls(TlsStream), + Tls(Box>), } impl AsyncRead for MaybeTlsStream { diff --git a/src/kiwi/src/ws.rs b/src/kiwi/src/ws.rs index 8859f9e..65a8038 100644 --- a/src/kiwi/src/ws.rs +++ b/src/kiwi/src/ws.rs @@ -57,7 +57,9 @@ where tokio::spawn(async move { let io = if let Some(acceptor) = acceptor { match acceptor.accept(stream).await { - Ok(stream) => hyper_util::rt::TokioIo::new(MaybeTlsStream::Tls(stream)), + Ok(stream) => { + hyper_util::rt::TokioIo::new(MaybeTlsStream::Tls(Box::new(stream))) + } Err(e) => { tracing::error!(addr = ?addr, "Failed to accept TLS connection: {}", e); return;