@@ -65,7 +65,7 @@ impl OptionalSslAcceptor for SslAcceptor {}
6565///
6666///let server = Server::bind("127.0.0.1:1234").unwrap();
6767///
68- ///for connection in server {
68+ ///for connection in server.filter_map(Result::ok) {
6969/// // Spawn a new thread for each connection.
7070/// thread::spawn(move || {
7171/// let mut client = connection.accept().unwrap();
@@ -109,7 +109,7 @@ impl OptionalSslAcceptor for SslAcceptor {}
109109///
110110///let server = Server::bind_secure("127.0.0.1:1234", acceptor).unwrap();
111111///
112- ///for connection in server {
112+ ///for connection in server.filter_map(Result::ok) {
113113/// // Spawn a new thread for each connection.
114114/// thread::spawn(move || {
115115/// let mut client = connection.accept().unwrap();
@@ -220,10 +220,10 @@ impl Server<SslAcceptor> {
220220
221221#[ cfg( feature="ssl" ) ]
222222impl Iterator for Server < SslAcceptor > {
223- type Item = WsUpgrade < SslStream < TcpStream > > ;
223+ type Item = AcceptResult < SslStream < TcpStream > > ;
224224
225225 fn next ( & mut self ) -> Option < <Self as Iterator >:: Item > {
226- self . accept ( ) . ok ( )
226+ Some ( self . accept ( ) )
227227 }
228228}
229229
@@ -265,9 +265,9 @@ impl Server<NoSslAcceptor> {
265265}
266266
267267impl Iterator for Server < NoSslAcceptor > {
268- type Item = WsUpgrade < TcpStream > ;
268+ type Item = AcceptResult < TcpStream > ;
269269
270270 fn next ( & mut self ) -> Option < <Self as Iterator >:: Item > {
271- self . accept ( ) . ok ( )
271+ Some ( self . accept ( ) )
272272 }
273273}
0 commit comments