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 {
5858#[ async_trait]
5959impl Manager < TcpStream , std:: io:: Error > for TcpConnection {
6060 async fn create ( & self ) -> Result < TcpStream , std:: io:: Error > {
61- Ok ( TcpStream :: connect ( self . addr ) . await ? )
61+ TcpStream :: connect ( self . addr ) . await
6262 }
6363
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 ?;
6567 Ok ( ( ) )
6668 }
6769}
Original file line number Diff line number Diff line change @@ -74,7 +74,12 @@ impl Manager<TlsStream<TcpStream>, Error> for TlsConnection {
7474 Ok ( tls_stream)
7575 }
7676
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) ?;
7883 Ok ( ( ) )
7984 }
8085}
You can’t perform that action at this time.
0 commit comments