mirror of https://github.com/fafhrd91/actix-net
reverse out-of-scope change
This commit is contained in:
parent
20c66f89ad
commit
6a1d254931
|
@ -10,20 +10,14 @@ async fn handle(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
let rt = actix_rt::System::with_tokio_rt(|| {
|
||||
actix_rt::System::with_tokio_rt(|| {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
});
|
||||
#[cfg(feature = "io-uring")]
|
||||
let rt = actix_rt::System::with_tokio_rt(|| {
|
||||
tokio_uring::Runtime::new(&tokio_uring::builder())
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
rt.block_on(async {
|
||||
// for io_uring feature use `tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()`
|
||||
})
|
||||
.block_on(async {
|
||||
let make_service =
|
||||
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
|
||||
|
||||
|
|
|
@ -4,22 +4,15 @@
|
|||
use actix_rt::System;
|
||||
|
||||
fn main() {
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
let system = System::with_tokio_rt(|| {
|
||||
System::with_tokio_rt(|| {
|
||||
// build system with a multi-thread tokio runtime.
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.worker_threads(2)
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
});
|
||||
#[cfg(feature = "io-uring")]
|
||||
let system = System::with_tokio_rt(|| {
|
||||
// build system with tokio uring runtime.
|
||||
tokio_uring::Runtime::new(&tokio_uring::builder())
|
||||
.unwrap()
|
||||
});
|
||||
system.block_on(async_main());
|
||||
})
|
||||
.block_on(async_main());
|
||||
}
|
||||
|
||||
// async main function that acts like #[actix_web::main] or #[tokio::main]
|
||||
|
|
Loading…
Reference in New Issue