File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ use std::future::Future;
5151use std:: io;
5252use std:: pin:: Pin ;
5353use std:: task:: { Context , Poll } ;
54- use tokio:: io:: { AsyncRead , AsyncWrite , ReadBuf } ;
54+ use tokio:: io:: { AsyncRead , AsyncWrite , BufReader , ReadBuf } ;
5555use tokio_postgres:: tls;
5656#[ cfg( feature = "runtime" ) ]
5757use tokio_postgres:: tls:: MakeTlsConnect ;
@@ -115,6 +115,7 @@ where
115115 type Future = Pin < Box < dyn Future < Output = Result < TlsStream < S > , native_tls:: Error > > + Send > > ;
116116
117117 fn connect ( self , stream : S ) -> Self :: Future {
118+ let stream = BufReader :: with_capacity ( 8192 , stream) ;
118119 let future = async move {
119120 let stream = self . connector . connect ( & self . domain , stream) . await ?;
120121
@@ -126,7 +127,7 @@ where
126127}
127128
128129/// The stream returned by `TlsConnector`.
129- pub struct TlsStream < S > ( tokio_native_tls:: TlsStream < S > ) ;
130+ pub struct TlsStream < S > ( tokio_native_tls:: TlsStream < BufReader < S > > ) ;
130131
131132impl < S > AsyncRead for TlsStream < S >
132133where
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ use std::pin::Pin;
5757#[ cfg( feature = "runtime" ) ]
5858use std:: sync:: Arc ;
5959use std:: task:: { Context , Poll } ;
60- use tokio:: io:: { AsyncRead , AsyncWrite , ReadBuf } ;
60+ use tokio:: io:: { AsyncRead , AsyncWrite , BufReader , ReadBuf } ;
6161use tokio_openssl:: SslStream ;
6262use tokio_postgres:: tls;
6363#[ cfg( feature = "runtime" ) ]
@@ -140,6 +140,7 @@ where
140140 type Future = Pin < Box < dyn Future < Output = Result < TlsStream < S > , Self :: Error > > + Send > > ;
141141
142142 fn connect ( self , stream : S ) -> Self :: Future {
143+ let stream = BufReader :: with_capacity ( 8192 , stream) ;
143144 let future = async move {
144145 let ssl = self . ssl . into_ssl ( & self . domain ) ?;
145146 let mut stream = SslStream :: new ( ssl, stream) ?;
@@ -182,7 +183,7 @@ impl Error for ConnectError {
182183}
183184
184185/// The stream returned by `TlsConnector`.
185- pub struct TlsStream < S > ( SslStream < S > ) ;
186+ pub struct TlsStream < S > ( SslStream < BufReader < S > > ) ;
186187
187188impl < S > AsyncRead for TlsStream < S >
188189where
You can’t perform that action at this time.
0 commit comments