Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
RequescoS committed Sep 29, 2023
1 parent 79340bf commit fd24629
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions utils/src/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fd24629

Please sign in to comment.