@@ -20,7 +20,6 @@ use pin_project_lite::pin_project;
2020#[ cfg( feature = "rt" ) ]
2121pub use spawning_handshake:: SpawningHandshakes ;
2222use std:: future:: Future ;
23- use std:: io;
2423use std:: pin:: Pin ;
2524use std:: task:: { Context , Poll } ;
2625use std:: time:: Duration ;
@@ -35,6 +34,9 @@ mod spawning_handshake;
3534#[ cfg( any( feature = "hyper-h1" , feature = "hyper-h2" ) ) ]
3635pub mod hyper;
3736
37+ #[ cfg( feature = "tokio-net" ) ]
38+ mod net;
39+
3840/// Default number of concurrent handshakes
3941pub const DEFAULT_MAX_HANDSHAKES : usize = 64 ;
4042/// Default timeout for the TLS handshake.
@@ -228,7 +230,7 @@ where
228230#[ cfg( feature = "rustls" ) ]
229231impl < C : AsyncRead + AsyncWrite + Unpin > AsyncTls < C > for tokio_rustls:: TlsAcceptor {
230232 type Stream = tokio_rustls:: server:: TlsStream < C > ;
231- type Error = io:: Error ;
233+ type Error = std :: io:: Error ;
232234 type AcceptFuture = tokio_rustls:: Accept < C > ;
233235
234236 fn accept ( & self , conn : C ) -> Self :: AcceptFuture {
@@ -305,42 +307,6 @@ pub fn builder<T>(tls: T) -> Builder<T> {
305307 }
306308}
307309
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-
344310pin_project ! {
345311 /// See [`AsyncAccept::until`]
346312 pub struct Until <A , E > {
0 commit comments