mirror of https://github.com/fafhrd91/actix-net
				
				
				
			Merge branch 'master' into mio-0.7.3
This commit is contained in:
		
						commit
						8fcaa1160f
					
				|  | @ -4,8 +4,6 @@ | ||||||
| //! [`AsyncWrite`], to framed streams implementing [`Sink`] and [`Stream`].
 | //! [`AsyncWrite`], to framed streams implementing [`Sink`] and [`Stream`].
 | ||||||
| //! Framed streams are also known as `transports`.
 | //! Framed streams are also known as `transports`.
 | ||||||
| //!
 | //!
 | ||||||
| //! [`AsyncRead`]: AsyncRead
 |  | ||||||
| //! [`AsyncWrite`]: AsyncWrite
 |  | ||||||
| //! [`Sink`]: futures_sink::Sink
 | //! [`Sink`]: futures_sink::Sink
 | ||||||
| //! [`Stream`]: futures_core::Stream
 | //! [`Stream`]: futures_core::Stream
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -138,7 +138,7 @@ impl<T: Address> fmt::Display for Connect<T> { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /// Iterator over addresses in a [`Connect`](struct.Connect.html) request.
 | /// Iterator over addresses in a [`Connect`] request.
 | ||||||
| #[derive(Clone)] | #[derive(Clone)] | ||||||
| pub struct ConnectAddrsIter<'a> { | pub struct ConnectAddrsIter<'a> { | ||||||
|     inner: Either<Option<SocketAddr>, vec_deque::Iter<'a, SocketAddr>>, |     inner: Either<Option<SocketAddr>, vec_deque::Iter<'a, SocketAddr>>, | ||||||
|  | @ -173,7 +173,7 @@ impl ExactSizeIterator for ConnectAddrsIter<'_> {} | ||||||
| 
 | 
 | ||||||
| impl FusedIterator for ConnectAddrsIter<'_> {} | impl FusedIterator for ConnectAddrsIter<'_> {} | ||||||
| 
 | 
 | ||||||
| /// Owned iterator over addresses in a [`Connect`](struct.Connect.html) request.
 | /// Owned iterator over addresses in a [`Connect`] request.
 | ||||||
| #[derive(Debug)] | #[derive(Debug)] | ||||||
| pub struct ConnectTakeAddrsIter { | pub struct ConnectTakeAddrsIter { | ||||||
|     inner: Either<Option<SocketAddr>, vec_deque::IntoIter<SocketAddr>>, |     inner: Either<Option<SocketAddr>, vec_deque::IntoIter<SocketAddr>>, | ||||||
|  |  | ||||||
|  | @ -333,7 +333,7 @@ impl Future for CleanupPending { | ||||||
|             let mut pending = cell.borrow_mut(); |             let mut pending = cell.borrow_mut(); | ||||||
|             let mut i = 0; |             let mut i = 0; | ||||||
|             while i != pending.len() { |             while i != pending.len() { | ||||||
|                 if let Poll::Ready(_) = Pin::new(&mut pending[i]).poll(cx) { |                 if Pin::new(&mut pending[i]).poll(cx).is_ready() { | ||||||
|                     pending.remove(i); |                     pending.remove(i); | ||||||
|                 } else { |                 } else { | ||||||
|                     i += 1; |                     i += 1; | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ use tokio::{runtime, task::LocalSet}; | ||||||
| ///
 | ///
 | ||||||
| /// See [module level][mod] documentation for more details.
 | /// See [module level][mod] documentation for more details.
 | ||||||
| ///
 | ///
 | ||||||
| /// [mod]: index.html
 | /// [mod]: crate
 | ||||||
| #[derive(Debug)] | #[derive(Debug)] | ||||||
| pub struct Runtime { | pub struct Runtime { | ||||||
|     local: LocalSet, |     local: LocalSet, | ||||||
|  | @ -33,7 +33,7 @@ impl Runtime { | ||||||
|     ///
 |     ///
 | ||||||
|     /// See [module level][mod] documentation for more details.
 |     /// See [module level][mod] documentation for more details.
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// [mod]: index.html
 |     /// [mod]: crate
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// # Examples
 |     /// # Examples
 | ||||||
|     ///
 |     ///
 | ||||||
|  |  | ||||||
|  | @ -66,7 +66,6 @@ impl System { | ||||||
|     /// It means that using this method currently it is impossible to make `actix-rt` work in the
 |     /// It means that using this method currently it is impossible to make `actix-rt` work in the
 | ||||||
|     /// alternative `tokio` `Runtime`s (e.g. provided by [`tokio_compat`]).
 |     /// alternative `tokio` `Runtime`s (e.g. provided by [`tokio_compat`]).
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// [`Arbiter`]: struct.Arbiter.html
 |  | ||||||
|     /// [`tokio_compat`]: https://crates.io/crates/tokio-compat
 |     /// [`tokio_compat`]: https://crates.io/crates/tokio-compat
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// # Examples
 |     /// # Examples
 | ||||||
|  | @ -130,7 +129,6 @@ impl System { | ||||||
|     /// It means that using this method currently it is impossible to make `actix-rt` work in the
 |     /// It means that using this method currently it is impossible to make `actix-rt` work in the
 | ||||||
|     /// alternative `tokio` `Runtime`s (e.g. provided by `tokio_compat`).
 |     /// alternative `tokio` `Runtime`s (e.g. provided by `tokio_compat`).
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// [`Arbiter`]: struct.Arbiter.html
 |  | ||||||
|     /// [`tokio_compat`]: https://crates.io/crates/tokio-compat
 |     /// [`tokio_compat`]: https://crates.io/crates/tokio-compat
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// # Arguments
 |     /// # Arguments
 | ||||||
|  |  | ||||||
|  | @ -58,7 +58,7 @@ impl Signals { | ||||||
|                     ), |                     ), | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 |           
 | ||||||
|             actix_rt::spawn(Signals { srv, streams }); |             actix_rt::spawn(Signals { srv, streams }); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| //! See [`Service`](trait.Service.html) docs for information on this crate's foundational trait.
 | //! See [`Service`] docs for information on this crate's foundational trait.
 | ||||||
| 
 | 
 | ||||||
| #![deny(rust_2018_idioms, nonstandard_style)] | #![deny(rust_2018_idioms, nonstandard_style)] | ||||||
| #![allow(clippy::type_complexity)] | #![allow(clippy::type_complexity)] | ||||||
|  | @ -67,7 +67,7 @@ pub use self::transform::{apply, Transform}; | ||||||
| /// ```
 | /// ```
 | ||||||
| ///
 | ///
 | ||||||
| /// Sometimes it is not necessary to implement the Service trait. For example, the above service
 | /// Sometimes it is not necessary to implement the Service trait. For example, the above service
 | ||||||
| /// could be rewritten as a simple function and passed to [fn_service](fn.fn_service.html).
 | /// could be rewritten as a simple function and passed to [fn_service](fn_service()).
 | ||||||
| ///
 | ///
 | ||||||
| /// ```rust,ignore
 | /// ```rust,ignore
 | ||||||
| /// async fn my_service(req: u8) -> Result<u64, MyError>;
 | /// async fn my_service(req: u8) -> Result<u64, MyError>;
 | ||||||
|  |  | ||||||
|  | @ -60,8 +60,6 @@ where | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /// A `Transform` implementation that wraps services with a [`TracingService`].
 | /// A `Transform` implementation that wraps services with a [`TracingService`].
 | ||||||
| ///
 |  | ||||||
| /// [`TracingService`]: struct.TracingService.html
 |  | ||||||
| pub struct TracingTransform<S, U, F> { | pub struct TracingTransform<S, U, F> { | ||||||
|     make_span: F, |     make_span: F, | ||||||
|     _p: PhantomData<fn(S, U)>, |     _p: PhantomData<fn(S, U)>, | ||||||
|  |  | ||||||
|  | @ -290,10 +290,8 @@ where | ||||||
|                 } |                 } | ||||||
|                 State::Error(_) => { |                 State::Error(_) => { | ||||||
|                     // flush write buffer
 |                     // flush write buffer
 | ||||||
|                     if !this.framed.is_write_buf_empty() { |                     if !this.framed.is_write_buf_empty() && this.framed.flush(cx).is_pending() { | ||||||
|                         if let Poll::Pending = this.framed.flush(cx) { |                         return Poll::Pending; | ||||||
|                             return Poll::Pending; |  | ||||||
|                         } |  | ||||||
|                     } |                     } | ||||||
|                     Poll::Ready(Err(this.state.take_error())) |                     Poll::Ready(Err(this.state.take_error())) | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ where | ||||||
|     type Future = InFlightServiceResponse<T>; |     type Future = InFlightServiceResponse<T>; | ||||||
| 
 | 
 | ||||||
|     fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { |     fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { | ||||||
|         if let Poll::Pending = self.service.poll_ready(cx)? { |         if self.service.poll_ready(cx)?.is_pending() { | ||||||
|             Poll::Pending |             Poll::Pending | ||||||
|         } else if !self.count.available(cx) { |         } else if !self.count.available(cx) { | ||||||
|             log::trace!("InFlight limit exceeded"); |             log::trace!("InFlight limit exceeded"); | ||||||
|  |  | ||||||
|  | @ -160,7 +160,12 @@ where | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // check nested service
 |         // check nested service
 | ||||||
|         if let Poll::Pending = self.service.poll_ready(cx).map_err(InOrderError::Service)? { |         if self | ||||||
|  |             .service | ||||||
|  |             .poll_ready(cx) | ||||||
|  |             .map_err(InOrderError::Service)? | ||||||
|  |             .is_pending() | ||||||
|  |         { | ||||||
|             Poll::Pending |             Poll::Pending | ||||||
|         } else { |         } else { | ||||||
|             Poll::Ready(Ok(())) |             Poll::Ready(Ok(())) | ||||||
|  |  | ||||||
|  | @ -19,6 +19,7 @@ use std::{fmt, rc}; | ||||||
| ///
 | ///
 | ||||||
| /// A single `AtomicWaker` may be reused for any number of calls to `register` or
 | /// A single `AtomicWaker` may be reused for any number of calls to `register` or
 | ||||||
| /// `wake`.
 | /// `wake`.
 | ||||||
|  | // TODO: Refactor to Cell when remove deprecated methods (@botika)
 | ||||||
| #[derive(Default)] | #[derive(Default)] | ||||||
| pub struct LocalWaker { | pub struct LocalWaker { | ||||||
|     pub(crate) waker: UnsafeCell<Option<Waker>>, |     pub(crate) waker: UnsafeCell<Option<Waker>>, | ||||||
|  | @ -34,6 +35,10 @@ impl LocalWaker { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[deprecated(
 | ||||||
|  |         since = "2.1.0", | ||||||
|  |         note = "In favor of `wake`. State of the register doesn't matter at `wake` up" | ||||||
|  |     )] | ||||||
|     #[inline] |     #[inline] | ||||||
|     /// Check if waker has been registered.
 |     /// Check if waker has been registered.
 | ||||||
|     pub fn is_registered(&self) -> bool { |     pub fn is_registered(&self) -> bool { | ||||||
|  | @ -47,9 +52,8 @@ impl LocalWaker { | ||||||
|     pub fn register(&self, waker: &Waker) -> bool { |     pub fn register(&self, waker: &Waker) -> bool { | ||||||
|         unsafe { |         unsafe { | ||||||
|             let w = self.waker.get(); |             let w = self.waker.get(); | ||||||
|             let is_registered = (*w).is_some(); |             let last_waker = w.replace(Some(waker.clone())); | ||||||
|             *w = Some(waker.clone()); |             last_waker.is_some() | ||||||
|             is_registered |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -63,6 +67,7 @@ impl LocalWaker { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[inline] | ||||||
|     /// Returns the last `Waker` passed to `register`, so that the user can wake it.
 |     /// Returns the last `Waker` passed to `register`, so that the user can wake it.
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// If a waker has not been registered, this returns `None`.
 |     /// If a waker has not been registered, this returns `None`.
 | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ use bytes::Bytes; | ||||||
| 
 | 
 | ||||||
| /// A UTF-8 encoded string with [`Bytes`] as a storage.
 | /// A UTF-8 encoded string with [`Bytes`] as a storage.
 | ||||||
| ///
 | ///
 | ||||||
| /// [`Bytes`]: https://docs.rs/bytes/0.5.3/bytes/struct.Bytes.html
 | /// [`Bytes`]: bytes::Bytes
 | ||||||
| #[derive(Clone, Eq, Ord, PartialOrd, Default)] | #[derive(Clone, Eq, Ord, PartialOrd, Default)] | ||||||
| pub struct ByteString(Bytes); | pub struct ByteString(Bytes); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue