@@ -24,7 +24,6 @@ pub struct Socks {
2424 udp_expiry_duration : Option < Duration > ,
2525 udp_capacity : Option < usize > ,
2626 udp_bind_addr : Option < ServerAddr > ,
27- nodelay : bool ,
2827}
2928
3029impl Default for Socks {
@@ -48,7 +47,6 @@ impl Socks {
4847 udp_expiry_duration : None ,
4948 udp_capacity : None ,
5049 udp_bind_addr : None ,
51- nodelay : false ,
5250 }
5351 }
5452
@@ -75,11 +73,6 @@ impl Socks {
7573 self . udp_bind_addr = Some ( a) ;
7674 }
7775
78- /// Set `TCP_NODELAY`
79- pub fn set_nodelay ( & mut self , nodelay : bool ) {
80- self . nodelay = nodelay;
81- }
82-
8376 /// Start serving
8477 pub async fn run ( self , client_config : & ServerAddr , balancer : PingBalancer ) -> io:: Result < ( ) > {
8578 let mut vfut = Vec :: new ( ) ;
@@ -133,13 +126,8 @@ impl Socks {
133126 }
134127 } ;
135128
136- if self . nodelay {
137- let _ = stream. set_nodelay ( true ) ;
138- }
139-
140129 let balancer = balancer. clone ( ) ;
141130 let context = self . context . clone ( ) ;
142- let nodelay = self . nodelay ;
143131 let udp_bind_addr = udp_bind_addr. clone ( ) ;
144132 let mode = self . mode ;
145133
@@ -150,7 +138,6 @@ impl Socks {
150138 balancer,
151139 peer_addr,
152140 mode,
153- nodelay,
154141 ) ) ;
155142 }
156143 }
@@ -163,7 +150,6 @@ impl Socks {
163150 balancer : PingBalancer ,
164151 peer_addr : SocketAddr ,
165152 mode : Mode ,
166- nodelay : bool ,
167153 ) -> io:: Result < ( ) > {
168154 use std:: io:: ErrorKind ;
169155
@@ -175,12 +161,12 @@ impl Socks {
175161
176162 match version_buffer[ 0 ] {
177163 0x04 => {
178- let handler = Socks4TcpHandler :: new ( context, nodelay , balancer, mode) ;
164+ let handler = Socks4TcpHandler :: new ( context, balancer, mode) ;
179165 handler. handle_socks4_client ( stream, peer_addr) . await
180166 }
181167
182168 0x05 => {
183- let handler = Socks5TcpHandler :: new ( context, udp_bind_addr, nodelay , balancer, mode) ;
169+ let handler = Socks5TcpHandler :: new ( context, udp_bind_addr, balancer, mode) ;
184170 handler. handle_socks5_client ( stream, peer_addr) . await
185171 }
186172
@@ -200,9 +186,8 @@ impl Socks {
200186 balancer : PingBalancer ,
201187 peer_addr : SocketAddr ,
202188 mode : Mode ,
203- nodelay : bool ,
204189 ) -> io:: Result < ( ) > {
205- let handler = Socks5TcpHandler :: new ( context, udp_bind_addr, nodelay , balancer, mode) ;
190+ let handler = Socks5TcpHandler :: new ( context, udp_bind_addr, balancer, mode) ;
206191 handler. handle_socks5_client ( stream, peer_addr) . await
207192 }
208193
0 commit comments