@@ -3,7 +3,6 @@ use std::io;
3
3
use std:: net:: { SocketAddr , TcpListener as StdTcpListener } ;
4
4
use std:: time:: Duration ;
5
5
6
- use futures_util:: FutureExt as _;
7
6
use tokio:: net:: TcpListener ;
8
7
use tokio:: time:: Delay ;
9
8
@@ -91,19 +90,13 @@ impl AddrIncoming {
91
90
fn poll_next_ ( & mut self , cx : & mut task:: Context < ' _ > ) -> Poll < io:: Result < AddrStream > > {
92
91
// Check if a previous timeout is active that was set by IO errors.
93
92
if let Some ( ref mut to) = self . timeout {
94
- match Pin :: new ( to) . poll ( cx) {
95
- Poll :: Ready ( ( ) ) => { }
96
- Poll :: Pending => return Poll :: Pending ,
97
- }
93
+ ready ! ( Pin :: new( to) . poll( cx) ) ;
98
94
}
99
95
self . timeout = None ;
100
96
101
- let accept = self . listener . accept ( ) ;
102
- futures_util:: pin_mut!( accept) ;
103
-
104
97
loop {
105
- match accept . poll_unpin ( cx) {
106
- Poll :: Ready ( Ok ( ( socket, addr) ) ) => {
98
+ match ready ! ( self . listener . poll_accept ( cx) ) {
99
+ Ok ( ( socket, addr) ) => {
107
100
if let Some ( dur) = self . tcp_keepalive_timeout {
108
101
if let Err ( e) = socket. set_keepalive ( Some ( dur) ) {
109
102
trace ! ( "error trying to set TCP keepalive: {}" , e) ;
@@ -114,8 +107,7 @@ impl AddrIncoming {
114
107
}
115
108
return Poll :: Ready ( Ok ( AddrStream :: new ( socket, addr) ) ) ;
116
109
}
117
- Poll :: Pending => return Poll :: Pending ,
118
- Poll :: Ready ( Err ( e) ) => {
110
+ Err ( e) => {
119
111
// Connection errors can be ignored directly, continue by
120
112
// accepting the next request.
121
113
if is_connection_error ( & e) {
0 commit comments