File tree 1 file changed +13
-4
lines changed
src/client/legacy/connect
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -438,12 +438,10 @@ where
438
438
}
439
439
}
440
440
441
- impl Connection for TokioIo < TcpStream > {
441
+ impl Connection for TcpStream {
442
442
fn connected ( & self ) -> Connected {
443
443
let connected = Connected :: new ( ) ;
444
- if let ( Ok ( remote_addr) , Ok ( local_addr) ) =
445
- ( self . inner ( ) . peer_addr ( ) , self . inner ( ) . local_addr ( ) )
446
- {
444
+ if let ( Ok ( remote_addr) , Ok ( local_addr) ) = ( self . peer_addr ( ) , self . local_addr ( ) ) {
447
445
connected. extra ( HttpInfo {
448
446
remote_addr,
449
447
local_addr,
@@ -454,6 +452,17 @@ impl Connection for TokioIo<TcpStream> {
454
452
}
455
453
}
456
454
455
+ // Implement `Connection` for generic `TokioIo<T>` so that external crates can
456
+ // implement their own `HttpConnector` with `TokioIo<CustomTcpStream>`.
457
+ impl < T > Connection for TokioIo < T >
458
+ where
459
+ T : Connection ,
460
+ {
461
+ fn connected ( & self ) -> Connected {
462
+ self . inner ( ) . connected ( )
463
+ }
464
+ }
465
+
457
466
impl HttpInfo {
458
467
/// Get the remote address of the transport used.
459
468
pub fn remote_addr ( & self ) -> SocketAddr {
You can’t perform that action at this time.
0 commit comments