@@ -20,7 +20,6 @@ use pin_project_lite::pin_project;
20
20
#[ cfg( feature = "rt" ) ]
21
21
pub use spawning_handshake:: SpawningHandshakes ;
22
22
use std:: future:: Future ;
23
- use std:: io;
24
23
use std:: pin:: Pin ;
25
24
use std:: task:: { Context , Poll } ;
26
25
use std:: time:: Duration ;
@@ -35,6 +34,9 @@ mod spawning_handshake;
35
34
#[ cfg( any( feature = "hyper-h1" , feature = "hyper-h2" ) ) ]
36
35
pub mod hyper;
37
36
37
+ #[ cfg( feature = "tokio-net" ) ]
38
+ mod net;
39
+
38
40
/// Default number of concurrent handshakes
39
41
pub const DEFAULT_MAX_HANDSHAKES : usize = 64 ;
40
42
/// Default timeout for the TLS handshake.
@@ -228,7 +230,7 @@ where
228
230
#[ cfg( feature = "rustls" ) ]
229
231
impl < C : AsyncRead + AsyncWrite + Unpin > AsyncTls < C > for tokio_rustls:: TlsAcceptor {
230
232
type Stream = tokio_rustls:: server:: TlsStream < C > ;
231
- type Error = io:: Error ;
233
+ type Error = std :: io:: Error ;
232
234
type AcceptFuture = tokio_rustls:: Accept < C > ;
233
235
234
236
fn accept ( & self , conn : C ) -> Self :: AcceptFuture {
@@ -305,42 +307,6 @@ pub fn builder<T>(tls: T) -> Builder<T> {
305
307
}
306
308
}
307
309
308
- #[ cfg( feature = "tokio-net" ) ]
309
- #[ cfg_attr( docsrs, doc( cfg( feature = "tokio-net" ) ) ) ]
310
- impl AsyncAccept for tokio:: net:: TcpListener {
311
- type Connection = tokio:: net:: TcpStream ;
312
- type Error = io:: Error ;
313
-
314
- fn poll_accept (
315
- self : Pin < & mut Self > ,
316
- cx : & mut Context < ' _ > ,
317
- ) -> Poll < Option < Result < Self :: Connection , Self :: Error > > > {
318
- match ( * self ) . poll_accept ( cx) {
319
- Poll :: Ready ( Ok ( ( stream, _) ) ) => Poll :: Ready ( Some ( Ok ( stream) ) ) ,
320
- Poll :: Ready ( Err ( e) ) => Poll :: Ready ( Some ( Err ( e) ) ) ,
321
- Poll :: Pending => Poll :: Pending ,
322
- }
323
- }
324
- }
325
-
326
- #[ cfg( all( unix, feature = "tokio-net" ) ) ]
327
- #[ cfg_attr( docsrs, doc( cfg( feature = "tokio-net" ) ) ) ]
328
- impl AsyncAccept for tokio:: net:: UnixListener {
329
- type Connection = tokio:: net:: UnixStream ;
330
- type Error = io:: Error ;
331
-
332
- fn poll_accept (
333
- self : Pin < & mut Self > ,
334
- cx : & mut Context < ' _ > ,
335
- ) -> Poll < Option < Result < Self :: Connection , Self :: Error > > > {
336
- match ( * self ) . poll_accept ( cx) {
337
- Poll :: Ready ( Ok ( ( stream, _) ) ) => Poll :: Ready ( Some ( Ok ( stream) ) ) ,
338
- Poll :: Ready ( Err ( e) ) => Poll :: Ready ( Some ( Err ( e) ) ) ,
339
- Poll :: Pending => Poll :: Pending ,
340
- }
341
- }
342
- }
343
-
344
310
pin_project ! {
345
311
/// See [`AsyncAccept::until`]
346
312
pub struct Until <A , E > {
0 commit comments