From fd246291269ef1b41d2c3ab70ccd1cc3f18a381e Mon Sep 17 00:00:00 2001 From: requesco Date: Fri, 29 Sep 2023 19:14:04 +0300 Subject: [PATCH] fmt --- utils/src/receiver.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/utils/src/receiver.rs b/utils/src/receiver.rs index f4dbf00..04de90f 100644 --- a/utils/src/receiver.rs +++ b/utils/src/receiver.rs @@ -46,20 +46,6 @@ impl TcpReceiver { } async fn connect_and_read(&self, addr: SocketAddr) -> io::Result<()> { - // TODO: there's no connect with timeout in tokio's TcpStream - // but we can create std::net::TcpStream and convert it to tokio's one - // like here https://docs.rs/tokio/latest/tokio/net/struct.TcpStream.html#method.from_std - // - // Example: - // let std_stream = std::net::TcpStream::connect_timeout(&addr, self.connect_timeout)?; - // std_stream.set_nonblocking(true)?; - // let stream = TcpStream::from_std(std_stream)?; - // - // Another approach is to use tokio::time::timeout like here - // https://stackoverflow.com/a/63465533 - // - // I didn't test any of those approaches - let stream = TcpStream::connect(&addr).await?; let mut stream = tokio::io::BufReader::new(stream);