mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 23:17:42 +02:00
@ -51,7 +51,7 @@ impl ClientBuilder {
|
||||
/// Use custom connector service.
|
||||
pub fn connector<T>(mut self, connector: T) -> Self
|
||||
where
|
||||
T: Service<Request = HttpConnect, Error = ConnectError> + 'static,
|
||||
T: Service<HttpConnect, Error = ConnectError> + 'static,
|
||||
T::Response: Connection,
|
||||
<T::Response as Connection>::Future: 'static,
|
||||
T::Future: 'static,
|
||||
|
@ -2,9 +2,9 @@ use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
use std::task::{Context, Poll};
|
||||
use std::{fmt, io, mem, net};
|
||||
use std::{fmt, io, net};
|
||||
|
||||
use actix_codec::{AsyncRead, AsyncWrite, Framed};
|
||||
use actix_codec::{AsyncRead, AsyncWrite, Framed, ReadBuf};
|
||||
use actix_http::body::Body;
|
||||
use actix_http::client::{
|
||||
Connect as ClientConnect, ConnectError, Connection, SendRequestError,
|
||||
@ -70,7 +70,7 @@ pub(crate) trait Connect {
|
||||
|
||||
impl<T> Connect for ConnectorWrapper<T>
|
||||
where
|
||||
T: Service<Request = ClientConnect, Error = ConnectError>,
|
||||
T: Service<ClientConnect, Error = ConnectError>,
|
||||
T::Response: Connection,
|
||||
<T::Response as Connection>::Io: 'static,
|
||||
<T::Response as Connection>::Future: 'static,
|
||||
@ -221,18 +221,11 @@ impl fmt::Debug for BoxedSocket {
|
||||
}
|
||||
|
||||
impl AsyncRead for BoxedSocket {
|
||||
unsafe fn prepare_uninitialized_buffer(
|
||||
&self,
|
||||
buf: &mut [mem::MaybeUninit<u8>],
|
||||
) -> bool {
|
||||
self.0.as_read().prepare_uninitialized_buffer(buf)
|
||||
}
|
||||
|
||||
fn poll_read(
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
buf: &mut [u8],
|
||||
) -> Poll<io::Result<usize>> {
|
||||
buf: &mut ReadBuf<'_>,
|
||||
) -> Poll<io::Result<()>> {
|
||||
Pin::new(self.get_mut().0.as_read_mut()).poll_read(cx, buf)
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use std::rc::Rc;
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::Duration;
|
||||
|
||||
use actix_rt::time::{delay_for, Delay};
|
||||
use actix_rt::time::{sleep, Sleep};
|
||||
use bytes::Bytes;
|
||||
use derive_more::From;
|
||||
use futures_core::Stream;
|
||||
@ -56,7 +56,8 @@ impl Into<SendRequestError> for PrepForSendingError {
|
||||
pub enum SendClientRequest {
|
||||
Fut(
|
||||
Pin<Box<dyn Future<Output = Result<ClientResponse, SendRequestError>>>>,
|
||||
Option<Delay>,
|
||||
// FIXME: use a pinned Sleep instead of box.
|
||||
Option<Pin<Box<Sleep>>>,
|
||||
bool,
|
||||
),
|
||||
Err(Option<SendRequestError>),
|
||||
@ -68,7 +69,7 @@ impl SendClientRequest {
|
||||
response_decompress: bool,
|
||||
timeout: Option<Duration>,
|
||||
) -> SendClientRequest {
|
||||
let delay = timeout.map(delay_for);
|
||||
let delay = timeout.map(|d| Box::pin(sleep(d)));
|
||||
SendClientRequest::Fut(send, delay, response_decompress)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user