File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ impl ConnectionType {
187187 }
188188 }
189189 }
190+
191+ fn is_proxy ( & self ) -> bool {
192+ matches ! ( self , ConnectionType :: Socks5Proxy ( _) )
193+ }
190194}
191195
192196#[ derive( Debug , Clone ) ]
Original file line number Diff line number Diff line change @@ -72,14 +72,18 @@ impl Peer {
7272 }
7373 }
7474
75- pub async fn run ( & mut self , connection : TcpStream ) -> Result < ( ) , PeerError > {
75+ pub async fn run (
76+ & mut self ,
77+ connection : TcpStream ,
78+ is_proxy_connection : bool ,
79+ ) -> Result < ( ) , PeerError > {
7680 let start_time = Instant :: now ( ) ;
7781 let ( tx, mut rx) = mpsc:: channel ( 32 ) ;
7882 let ( reader, mut writer) = connection. into_split ( ) ;
7983 let mut reader = BufReader :: new ( reader) ;
8084 // If a peer signals for V2 we will use it, otherwise just use plaintext.
8185 let ( mut outbound_messages, mut peer_reader) =
82- if self . source . service_flags ( ) . has ( ServiceFlags :: P2P_V2 ) {
86+ if self . source . service_flags ( ) . has ( ServiceFlags :: P2P_V2 ) && !is_proxy_connection {
8387 let handshake_result = tokio:: time:: timeout (
8488 V2_HANDSHAKE_TIMEOUT ,
8589 self . try_handshake ( & mut writer, & mut reader) ,
Original file line number Diff line number Diff line change @@ -141,7 +141,8 @@ impl PeerMap {
141141 return Err ( e) ;
142142 }
143143 } ;
144- let handle = tokio:: spawn ( async move { peer. run ( connection) . await } ) ;
144+ let is_proxy = self . connector . is_proxy ( ) ;
145+ let handle = tokio:: spawn ( async move { peer. run ( connection, is_proxy) . await } ) ;
145146 self . map . insert (
146147 self . current_id ,
147148 ManagedPeer {
You can’t perform that action at this time.
0 commit comments