From 326eed5ee007209b68527d7247e6f984642c536f Mon Sep 17 00:00:00 2001 From: open-trade Date: Wed, 19 Jan 2022 16:40:05 +0800 Subject: [PATCH] make tcp sync --- libs/hbb_common/src/tcp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/hbb_common/src/tcp.rs b/libs/hbb_common/src/tcp.rs index 9ee33ca5a..86f67688c 100644 --- a/libs/hbb_common/src/tcp.rs +++ b/libs/hbb_common/src/tcp.rs @@ -18,7 +18,7 @@ use tokio_socks::{tcp::Socks5Stream, IntoTargetAddr, ToProxyAddrs}; use tokio_util::codec::Framed; pub trait TcpStreamTrait: AsyncRead + AsyncWrite + Unpin {} -pub struct DynTcpStream(Box); +pub struct DynTcpStream(Box); pub struct FramedStream( Framed, @@ -42,7 +42,7 @@ impl DerefMut for FramedStream { } impl Deref for DynTcpStream { - type Target = Box; + type Target = Box; fn deref(&self) -> &Self::Target { &self.0 @@ -149,7 +149,7 @@ impl FramedStream { self.3 = ms; } - pub fn from(stream: impl TcpStreamTrait + Send + 'static, addr: SocketAddr) -> Self { + pub fn from(stream: impl TcpStreamTrait + Send + Sync + 'static, addr: SocketAddr) -> Self { Self( Framed::new(DynTcpStream(Box::new(stream)), BytesCodec::new()), addr,