mirror of
https://github.com/actix/actix-web.git
synced 2024-12-26 18:10:37 +00:00
Allow user to provide addr to custom resolver
We basically swaps Addr with Recipient to enable user to use custom resolver
This commit is contained in:
parent
389cb13cd6
commit
9aab382ea8
3 changed files with 10 additions and 6 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
## Changed
|
||||
|
||||
* `ClientConnector::resolver` now accepts `Into<Recipient>` instead of `Addr`. It enables user to implement own resolver.
|
||||
|
||||
* `QueryConfig` and `PathConfig` are made public.
|
||||
|
||||
## [0.7.14] - 2018-11-14
|
||||
|
|
|
@ -61,7 +61,7 @@ flate2-rust = ["flate2/rust_backend"]
|
|||
cell = ["actix-net/cell"]
|
||||
|
||||
[dependencies]
|
||||
actix = "0.7.6"
|
||||
actix = "0.7.7"
|
||||
actix-net = "0.2.2"
|
||||
|
||||
askama_escape = "0.1.0"
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{fmt, io, mem, time};
|
|||
|
||||
use actix::resolver::{Connect as ResolveConnect, Resolver, ResolverError};
|
||||
use actix::{
|
||||
fut, Actor, ActorFuture, ActorResponse, Addr, AsyncContext, Context,
|
||||
fut, Actor, ActorFuture, ActorResponse, AsyncContext, Context,
|
||||
ContextFutureSpawner, Handler, Message, Recipient, StreamHandler, Supervised,
|
||||
SystemService, WrapFuture,
|
||||
};
|
||||
|
@ -220,7 +220,7 @@ pub struct ClientConnector {
|
|||
acq_tx: mpsc::UnboundedSender<AcquiredConnOperation>,
|
||||
acq_rx: Option<mpsc::UnboundedReceiver<AcquiredConnOperation>>,
|
||||
|
||||
resolver: Option<Addr<Resolver>>,
|
||||
resolver: Option<Recipient<ResolveConnect>>,
|
||||
conn_lifetime: Duration,
|
||||
conn_keep_alive: Duration,
|
||||
limit: usize,
|
||||
|
@ -239,7 +239,7 @@ impl Actor for ClientConnector {
|
|||
|
||||
fn started(&mut self, ctx: &mut Self::Context) {
|
||||
if self.resolver.is_none() {
|
||||
self.resolver = Some(Resolver::from_registry())
|
||||
self.resolver = Some(Resolver::from_registry().recipient())
|
||||
}
|
||||
self.collect_periodic(ctx);
|
||||
ctx.add_stream(self.acq_rx.take().unwrap());
|
||||
|
@ -503,8 +503,10 @@ impl ClientConnector {
|
|||
}
|
||||
|
||||
/// Use custom resolver actor
|
||||
pub fn resolver(mut self, addr: Addr<Resolver>) -> Self {
|
||||
self.resolver = Some(addr);
|
||||
///
|
||||
/// By default actix's Resolver is used.
|
||||
pub fn resolver<A: Into<Recipient<ResolveConnect>>>(mut self, addr: A) -> Self {
|
||||
self.resolver = Some(addr.into());
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue