File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,12 @@ impl AsyncWrite for TcpConnWrapper {
58
58
#[ async_trait]
59
59
impl Manager < TcpStream , std:: io:: Error > for TcpConnection {
60
60
async fn create ( & self ) -> Result < TcpStream , std:: io:: Error > {
61
- Ok ( TcpStream :: connect ( self . addr ) . await ? )
61
+ TcpStream :: connect ( self . addr ) . await
62
62
}
63
63
64
- async fn recycle ( & self , _conn : & mut TcpStream ) -> RecycleResult < std:: io:: Error > {
64
+ async fn recycle ( & self , conn : & mut TcpStream ) -> RecycleResult < std:: io:: Error > {
65
+ let mut buf = [ 0 ; 4 ] ;
66
+ conn. peek ( & mut buf[ ..] ) . await ?;
65
67
Ok ( ( ) )
66
68
}
67
69
}
Original file line number Diff line number Diff line change @@ -74,7 +74,12 @@ impl Manager<TlsStream<TcpStream>, Error> for TlsConnection {
74
74
Ok ( tls_stream)
75
75
}
76
76
77
- async fn recycle ( & self , _conn : & mut TlsStream < TcpStream > ) -> RecycleResult < Error > {
77
+ async fn recycle ( & self , conn : & mut TlsStream < TcpStream > ) -> RecycleResult < Error > {
78
+ let mut buf = [ 0 ; 4 ] ;
79
+ conn. get_ref ( )
80
+ . peek ( & mut buf[ ..] )
81
+ . await
82
+ . map_err ( Error :: from) ?;
78
83
Ok ( ( ) )
79
84
}
80
85
}
You can’t perform that action at this time.
0 commit comments