mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-26 19:47:43 +02:00
use actix deps instead of tokio
This commit is contained in:
@ -19,14 +19,10 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-service = "1.0.0-alpha.1"
|
||||
actix-rt = "1.0.0-alpha.1"
|
||||
actix-codec = "0.2.0-alpha.1"
|
||||
bytes = "0.4"
|
||||
either = "1.5.2"
|
||||
futures = "0.3.1"
|
||||
pin-project = "0.4.5"
|
||||
tokio-timer = "0.3.0-alpha.6"
|
||||
tokio-executor = { version="=0.2.0-alpha.6", features=["current-thread"] }
|
||||
log = "0.4"
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "1.0.0-alpha.1"
|
||||
|
@ -287,7 +287,7 @@ where
|
||||
inner.task.wake();
|
||||
ready(())
|
||||
});
|
||||
tokio_executor::current_thread::spawn(fut);
|
||||
actix_rt::spawn(fut);
|
||||
}
|
||||
Poll::Pending => return false,
|
||||
Poll::Ready(Err(err)) => {
|
||||
|
@ -131,7 +131,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn call(&mut self, _: ()) -> Self::Future {
|
||||
tokio_timer::delay_for(self.0)
|
||||
actix_rt::time::delay_for(self.0)
|
||||
.then(|_| ok::<_, ()>(()))
|
||||
.boxed_local()
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use actix_rt::time::{delay, Delay};
|
||||
use actix_service::{Service, ServiceFactory};
|
||||
use futures::future::{ok, Ready};
|
||||
use tokio_timer::{delay, Delay};
|
||||
|
||||
use super::time::{LowResTime, LowResTimeService};
|
||||
|
||||
|
@ -174,7 +174,7 @@ where
|
||||
|
||||
let task = self.task.clone();
|
||||
let fut = self.service.call(request);
|
||||
tokio_executor::current_thread::spawn(async move {
|
||||
actix_rt::spawn(async move {
|
||||
let res = fut.await;
|
||||
task.wake();
|
||||
let _ = tx1.send(res);
|
||||
@ -252,7 +252,7 @@ mod tests {
|
||||
let _ = lazy(|cx| srv.poll_ready(cx)).await;
|
||||
|
||||
// dispatcher do this
|
||||
tokio_timer::delay_for(Duration::from_millis(100)).await;
|
||||
actix_rt::time::delay_for(Duration::from_millis(100)).await;
|
||||
let _ = lazy(|cx| srv.poll_ready(cx)).await;
|
||||
|
||||
assert_eq!(res1.await.unwrap(), 1);
|
||||
|
@ -2,9 +2,9 @@ use std::convert::Infallible;
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::{self, Duration, Instant};
|
||||
|
||||
use actix_rt::time::delay_for;
|
||||
use actix_service::{Service, ServiceFactory};
|
||||
use futures::future::{ok, ready, FutureExt, Ready};
|
||||
use tokio_timer::delay_for;
|
||||
|
||||
use super::cell::Cell;
|
||||
|
||||
@ -79,7 +79,7 @@ impl LowResTimeService {
|
||||
b.resolution
|
||||
};
|
||||
|
||||
tokio_executor::current_thread::spawn(delay_for(interval).then(move |_| {
|
||||
actix_rt::spawn(delay_for(interval).then(move |_| {
|
||||
inner.get_mut().current.take();
|
||||
ready(())
|
||||
}));
|
||||
@ -144,7 +144,7 @@ impl SystemTimeService {
|
||||
b.resolution
|
||||
};
|
||||
|
||||
tokio_executor::current_thread::spawn(delay_for(interval).then(move |_| {
|
||||
actix_rt::spawn(delay_for(interval).then(move |_| {
|
||||
inner.get_mut().current.take();
|
||||
ready(())
|
||||
}));
|
||||
|
@ -8,9 +8,9 @@ use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::{fmt, time};
|
||||
|
||||
use actix_rt::time::{delay_for, Delay};
|
||||
use actix_service::{IntoService, Service, Transform};
|
||||
use futures::future::{ok, Ready};
|
||||
use tokio_timer::{clock, delay, Delay};
|
||||
|
||||
/// Applies a timeout to requests.
|
||||
#[derive(Debug)]
|
||||
@ -138,7 +138,7 @@ where
|
||||
fn call(&mut self, request: S::Request) -> Self::Future {
|
||||
TimeoutServiceResponse {
|
||||
fut: self.service.call(request),
|
||||
sleep: delay(clock::now() + self.timeout),
|
||||
sleep: delay_for(self.timeout),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn call(&mut self, _: ()) -> Self::Future {
|
||||
tokio_timer::delay_for(self.0)
|
||||
actix_rt::time::delay_for(self.0)
|
||||
.then(|_| ok::<_, ()>(()))
|
||||
.boxed_local()
|
||||
}
|
||||
|
Reference in New Issue
Block a user