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;
51
51
use std:: io;
52
52
use std:: pin:: Pin ;
53
53
use std:: task:: { Context , Poll } ;
54
- use tokio:: io:: { AsyncRead , AsyncWrite , ReadBuf } ;
54
+ use tokio:: io:: { AsyncRead , AsyncWrite , BufReader , ReadBuf } ;
55
55
use tokio_postgres:: tls;
56
56
#[ cfg( feature = "runtime" ) ]
57
57
use tokio_postgres:: tls:: MakeTlsConnect ;
@@ -115,6 +115,7 @@ where
115
115
type Future = Pin < Box < dyn Future < Output = Result < TlsStream < S > , native_tls:: Error > > + Send > > ;
116
116
117
117
fn connect ( self , stream : S ) -> Self :: Future {
118
+ let stream = BufReader :: with_capacity ( 8192 , stream) ;
118
119
let future = async move {
119
120
let stream = self . connector . connect ( & self . domain , stream) . await ?;
120
121
@@ -126,7 +127,7 @@ where
126
127
}
127
128
128
129
/// 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 > > ) ;
130
131
131
132
impl < S > AsyncRead for TlsStream < S >
132
133
where
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ use std::pin::Pin;
57
57
#[ cfg( feature = "runtime" ) ]
58
58
use std:: sync:: Arc ;
59
59
use std:: task:: { Context , Poll } ;
60
- use tokio:: io:: { AsyncRead , AsyncWrite , ReadBuf } ;
60
+ use tokio:: io:: { AsyncRead , AsyncWrite , BufReader , ReadBuf } ;
61
61
use tokio_openssl:: SslStream ;
62
62
use tokio_postgres:: tls;
63
63
#[ cfg( feature = "runtime" ) ]
@@ -140,6 +140,7 @@ where
140
140
type Future = Pin < Box < dyn Future < Output = Result < TlsStream < S > , Self :: Error > > + Send > > ;
141
141
142
142
fn connect ( self , stream : S ) -> Self :: Future {
143
+ let stream = BufReader :: with_capacity ( 8192 , stream) ;
143
144
let future = async move {
144
145
let ssl = self . ssl . into_ssl ( & self . domain ) ?;
145
146
let mut stream = SslStream :: new ( ssl, stream) ?;
@@ -182,7 +183,7 @@ impl Error for ConnectError {
182
183
}
183
184
184
185
/// The stream returned by `TlsConnector`.
185
- pub struct TlsStream < S > ( SslStream < S > ) ;
186
+ pub struct TlsStream < S > ( SslStream < BufReader < S > > ) ;
186
187
187
188
impl < S > AsyncRead for TlsStream < S >
188
189
where
You can’t perform that action at this time.
0 commit comments