1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

update actix Addr; make ClientConnector thread safe

This commit is contained in:
Nikolay Kim
2018-05-27 05:02:49 -07:00
parent 7c71171602
commit be2ceb7c66
9 changed files with 157 additions and 253 deletions

View File

@@ -4,11 +4,10 @@ use futures::{Async, Future, Poll};
use smallvec::SmallVec;
use std::marker::PhantomData;
use actix::dev::{ContextImpl, SyncEnvelope, ToEnvelope};
use actix::dev::{ContextImpl, Envelope, ToEnvelope};
use actix::fut::ActorFuture;
use actix::{
Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle,
Syn, Unsync,
};
use body::{Binary, Body};
@@ -90,15 +89,9 @@ where
fn cancel_future(&mut self, handle: SpawnHandle) -> bool {
self.inner.cancel_future(handle)
}
#[doc(hidden)]
#[inline]
fn unsync_address(&mut self) -> Addr<Unsync, A> {
self.inner.unsync_address()
}
#[doc(hidden)]
#[inline]
fn sync_address(&mut self) -> Addr<Syn, A> {
self.inner.sync_address()
fn address(&mut self) -> Addr<A> {
self.inner.address()
}
}
@@ -223,14 +216,14 @@ where
}
}
impl<A, M, S> ToEnvelope<Syn, A, M> for HttpContext<A, S>
impl<A, M, S> ToEnvelope<A, M> for HttpContext<A, S>
where
A: Actor<Context = HttpContext<A, S>> + Handler<M>,
M: Message + Send + 'static,
M::Result: Send,
{
fn pack(msg: M, tx: Option<Sender<M::Result>>) -> SyncEnvelope<A> {
SyncEnvelope::new(msg, tx)
fn pack(msg: M, tx: Option<Sender<M::Result>>) -> Envelope<A> {
Envelope::new(msg, tx)
}
}