Skip to content

Commit

Permalink
enable tcp_nodelay on server
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhou committed Jan 15, 2022
1 parent 819d6ed commit b8444c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ impl<'a> Stream for Incoming<'a> {
&peer_addr, &local_addr
);

debug!("incoming nodelay is {:?}", socket.nodelay());
let _ = socket.set_nodelay(true);
debug!("incoming nodelay is {:?}", socket.nodelay());

// Wrap the TcpStream into Socks5Socket
let socket = Socks5Socket::new(socket, self.0.config.clone());

Expand Down Expand Up @@ -529,6 +533,10 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Socks5Socket<T> {

debug!("Connected to remote destination");

debug!("outbound nodelay is {:?}", outbound.nodelay());
let _ = outbound.set_nodelay(true);
debug!("outbound nodelay is {:?}", outbound.nodelay());

// TODO: convert this to the real address
self.inner
.write(&[
Expand Down

0 comments on commit b8444c4

Please sign in to comment.