mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 09:42:40 +01:00
fix deprecated warnings
This commit is contained in:
parent
818d0bc187
commit
87a822e093
@ -3,7 +3,7 @@ use std::net::Shutdown;
|
|||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{fmt, io, mem, time};
|
use std::{fmt, io, mem, time};
|
||||||
|
|
||||||
use actix::resolver::{Connect as ResolveConnect, Connector, ConnectorError};
|
use actix::resolver::{Connect as ResolveConnect, Resolver, ResolverError};
|
||||||
use actix::{
|
use actix::{
|
||||||
fut, Actor, ActorContext, ActorFuture, ActorResponse, Addr, AsyncContext, Context,
|
fut, Actor, ActorContext, ActorFuture, ActorResponse, Addr, AsyncContext, Context,
|
||||||
ContextFutureSpawner, Handler, Message, Recipient, StreamHandler, Supervised,
|
ContextFutureSpawner, Handler, Message, Recipient, StreamHandler, Supervised,
|
||||||
@ -139,7 +139,7 @@ pub enum ClientConnectorError {
|
|||||||
|
|
||||||
/// Connection error
|
/// Connection error
|
||||||
#[fail(display = "{}", _0)]
|
#[fail(display = "{}", _0)]
|
||||||
Connector(#[cause] ConnectorError),
|
Connector(#[cause] ResolverError),
|
||||||
|
|
||||||
/// Connection took too long
|
/// Connection took too long
|
||||||
#[fail(display = "Timeout while establishing connection")]
|
#[fail(display = "Timeout while establishing connection")]
|
||||||
@ -154,10 +154,10 @@ pub enum ClientConnectorError {
|
|||||||
IoError(#[cause] io::Error),
|
IoError(#[cause] io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ConnectorError> for ClientConnectorError {
|
impl From<ResolverError> for ClientConnectorError {
|
||||||
fn from(err: ConnectorError) -> ClientConnectorError {
|
fn from(err: ResolverError) -> ClientConnectorError {
|
||||||
match err {
|
match err {
|
||||||
ConnectorError::Timeout => ClientConnectorError::Timeout,
|
ResolverError::Timeout => ClientConnectorError::Timeout,
|
||||||
_ => ClientConnectorError::Connector(err),
|
_ => ClientConnectorError::Connector(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ pub struct ClientConnector {
|
|||||||
acq_tx: mpsc::UnboundedSender<AcquiredConnOperation>,
|
acq_tx: mpsc::UnboundedSender<AcquiredConnOperation>,
|
||||||
acq_rx: Option<mpsc::UnboundedReceiver<AcquiredConnOperation>>,
|
acq_rx: Option<mpsc::UnboundedReceiver<AcquiredConnOperation>>,
|
||||||
|
|
||||||
resolver: Option<Addr<Connector>>,
|
resolver: Option<Addr<Resolver>>,
|
||||||
conn_lifetime: Duration,
|
conn_lifetime: Duration,
|
||||||
conn_keep_alive: Duration,
|
conn_keep_alive: Duration,
|
||||||
limit: usize,
|
limit: usize,
|
||||||
@ -217,7 +217,7 @@ impl Actor for ClientConnector {
|
|||||||
|
|
||||||
fn started(&mut self, ctx: &mut Self::Context) {
|
fn started(&mut self, ctx: &mut Self::Context) {
|
||||||
if self.resolver.is_none() {
|
if self.resolver.is_none() {
|
||||||
self.resolver = Some(Connector::from_registry())
|
self.resolver = Some(Resolver::from_registry())
|
||||||
}
|
}
|
||||||
self.collect_periodic(ctx);
|
self.collect_periodic(ctx);
|
||||||
ctx.add_stream(self.acq_rx.take().unwrap());
|
ctx.add_stream(self.acq_rx.take().unwrap());
|
||||||
@ -397,7 +397,7 @@ impl ClientConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Use custom resolver actor
|
/// Use custom resolver actor
|
||||||
pub fn resolver(mut self, addr: Addr<Connector>) -> Self {
|
pub fn resolver(mut self, addr: Addr<Resolver>) -> Self {
|
||||||
self.resolver = Some(addr);
|
self.resolver = Some(addr);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ impl fut::ActorFuture for Maintenance {
|
|||||||
let conn = AcquiredConn(key.clone(), Some(act.acq_tx.clone()));
|
let conn = AcquiredConn(key.clone(), Some(act.acq_tx.clone()));
|
||||||
|
|
||||||
fut::WrapFuture::<ClientConnector>::actfuture(
|
fut::WrapFuture::<ClientConnector>::actfuture(
|
||||||
Connector::from_registry().send(
|
Resolver::from_registry().send(
|
||||||
ResolveConnect::host_and_port(&conn.0.host, conn.0.port)
|
ResolveConnect::host_and_port(&conn.0.host, conn.0.port)
|
||||||
.timeout(waiter.conn_timeout),
|
.timeout(waiter.conn_timeout),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user