1
1
use std:: {
2
2
future:: Future ,
3
3
io,
4
- mem:: MaybeUninit ,
5
4
pin:: Pin ,
6
5
sync:: Arc ,
7
6
task:: { Context , Poll } ,
8
7
} ;
9
8
10
- use bytes:: { Buf , BufMut } ;
11
9
use futures:: future:: { FutureExt , TryFutureExt } ;
12
10
use ring:: digest;
13
11
use rustls:: { ClientConfig , Session } ;
14
- use tokio:: io:: { AsyncRead , AsyncWrite } ;
12
+ use tokio:: io:: { AsyncRead , AsyncWrite , ReadBuf } ;
15
13
use tokio_postgres:: tls:: { ChannelBinding , MakeTlsConnect , TlsConnect } ;
16
14
use tokio_rustls:: { client:: TlsStream , TlsConnector } ;
17
15
use webpki:: { DNSName , DNSNameRef } ;
@@ -93,25 +91,11 @@ where
93
91
fn poll_read (
94
92
mut self : Pin < & mut Self > ,
95
93
cx : & mut Context ,
96
- buf : & mut [ u8 ] ,
97
- ) -> Poll < tokio:: io:: Result < usize > > {
94
+ buf : & mut ReadBuf < ' _ > ,
95
+ ) -> Poll < tokio:: io:: Result < ( ) > > {
98
96
self . 0 . as_mut ( ) . poll_read ( cx, buf)
99
97
}
100
98
101
- unsafe fn prepare_uninitialized_buffer ( & self , buf : & mut [ MaybeUninit < u8 > ] ) -> bool {
102
- self . 0 . prepare_uninitialized_buffer ( buf)
103
- }
104
-
105
- fn poll_read_buf < B : BufMut > (
106
- mut self : Pin < & mut Self > ,
107
- cx : & mut Context ,
108
- buf : & mut B ,
109
- ) -> Poll < tokio:: io:: Result < usize > >
110
- where
111
- Self : Sized ,
112
- {
113
- self . 0 . as_mut ( ) . poll_read_buf ( cx, buf)
114
- }
115
99
}
116
100
117
101
impl < S > AsyncWrite for RustlsStream < S >
@@ -134,16 +118,6 @@ where
134
118
self . 0 . as_mut ( ) . poll_shutdown ( cx)
135
119
}
136
120
137
- fn poll_write_buf < B : Buf > (
138
- mut self : Pin < & mut Self > ,
139
- cx : & mut Context ,
140
- buf : & mut B ,
141
- ) -> Poll < tokio:: io:: Result < usize > >
142
- where
143
- Self : Sized ,
144
- {
145
- self . 0 . as_mut ( ) . poll_write_buf ( cx, buf)
146
- }
147
121
}
148
122
149
123
#[ cfg( test) ]
@@ -157,7 +131,7 @@ mod tests {
157
131
let config = rustls:: ClientConfig :: new ( ) ;
158
132
let tls = super :: MakeRustlsConnect :: new ( config) ;
159
133
let ( client, conn) =
160
- tokio_postgres:: connect ( "sslmode=require host=localhost user=postgres" , tls)
134
+ tokio_postgres:: connect ( "sslmode=require host=localhost port=5432 user=postgres" , tls)
161
135
. await
162
136
. expect ( "connect" ) ;
163
137
tokio:: spawn ( conn. map_err ( |e| panic ! ( "{:?}" , e) ) ) ;
0 commit comments