disable Nagle's algorithm for TCP connections

This commit is contained in:
Dirkjan Ochtman
2020-10-15 13:20:39 +02:00
parent e062ea4657
commit 3c0158a9d0
2 changed files with 6 additions and 4 deletions

View File

@@ -40,9 +40,9 @@ impl Connect for AsyncStdTcpStream {
type Transport = AsyncStdTcpStream;
async fn connect(addr: SocketAddr) -> io::Result<Self::Transport> {
async_std::net::TcpStream::connect(addr)
.await
.map(AsyncStdTcpStream)
let stream = async_std::net::TcpStream::connect(addr).await?;
stream.set_nodelay(true)?;
Ok(AsyncStdTcpStream(stream))
}
}