mirror of https://github.com/fafhrd91/actix-net
Compare commits
5 Commits
d65d399376
...
951f52215f
Author | SHA1 | Date |
---|---|---|
|
951f52215f | |
|
347fc17035 | |
|
4cb04042f5 | |
|
e6ddf0ccff | |
|
192d0661e9 |
|
@ -64,7 +64,7 @@ jobs:
|
|||
toolchain: ${{ matrix.version }}
|
||||
|
||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
uses: taiki-e/install-action@v2.56.13
|
||||
with:
|
||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||
|
||||
|
@ -121,7 +121,7 @@ jobs:
|
|||
toolchain: nightly
|
||||
|
||||
- name: Install cargo-hack & cargo-minimal-versions
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
uses: taiki-e/install-action@v2.56.13
|
||||
with:
|
||||
tool: cargo-hack,cargo-minimal-versions
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ jobs:
|
|||
toolchain: ${{ matrix.version.version }}
|
||||
|
||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
uses: taiki-e/install-action@v2.56.13
|
||||
with:
|
||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||
|
||||
|
@ -125,7 +125,7 @@ jobs:
|
|||
toolchain: nightly
|
||||
|
||||
- name: Install just
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
uses: taiki-e/install-action@v2.56.13
|
||||
with:
|
||||
tool: just
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
components: llvm-tools-preview
|
||||
|
||||
- name: Install cargo-llvm-cov
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
uses: taiki-e/install-action@v2.56.13
|
||||
with:
|
||||
tool: cargo-llvm-cov
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ jobs:
|
|||
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
||||
|
||||
- name: Install just
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
uses: taiki-e/install-action@v2.56.13
|
||||
with:
|
||||
tool: just
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ dependencies = [
|
|||
"futures-util",
|
||||
"mio",
|
||||
"pretty_env_logger",
|
||||
"socket2 0.5.10",
|
||||
"socket2 0.6.0",
|
||||
"static_assertions",
|
||||
"tokio",
|
||||
"tokio-uring",
|
||||
|
@ -1903,9 +1903,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.8"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -1966,6 +1966,16 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.5.2"
|
||||
|
@ -2271,44 +2281,42 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.22"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
||||
checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_write",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_write"
|
||||
version = "0.1.1"
|
||||
name = "toml_datetime"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
||||
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30"
|
||||
dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
|
@ -2430,9 +2438,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "trybuild"
|
||||
version = "1.0.105"
|
||||
version = "1.0.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c9bf9513a2f4aeef5fdac8677d7d349c79fdbcc03b9c86da6e9d254f1e43be2"
|
||||
checksum = "65af40ad689f2527aebbd37a0a816aea88ff5f774ceabe99de5be02f2f91dae2"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"serde",
|
||||
|
@ -2849,9 +2857,6 @@ name = "winnow"
|
|||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
|
|
|
@ -10,6 +10,7 @@ fn main() {
|
|||
.worker_threads(2)
|
||||
.enable_all()
|
||||
.build()
|
||||
.map(std::sync::Arc::new)
|
||||
.unwrap()
|
||||
})
|
||||
.block_on(async_main());
|
||||
|
|
|
@ -109,7 +109,7 @@ impl Arbiter {
|
|||
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
|
||||
pub fn with_tokio_rt<F>(runtime_factory: F) -> Arbiter
|
||||
where
|
||||
F: FnOnce() -> tokio::runtime::Runtime + Send + 'static,
|
||||
F: FnOnce() -> std::sync::Arc<tokio::runtime::Runtime> + Send + 'static,
|
||||
{
|
||||
let sys = System::current();
|
||||
let system_id = sys.id();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use std::{future::Future, io};
|
||||
|
||||
use std::{sync::Arc, future::Future, io};
|
||||
use tokio::task::{JoinHandle, LocalSet};
|
||||
|
||||
/// A Tokio-based runtime proxy.
|
||||
|
@ -9,14 +8,14 @@ use tokio::task::{JoinHandle, LocalSet};
|
|||
#[derive(Debug)]
|
||||
pub struct Runtime {
|
||||
local: LocalSet,
|
||||
rt: tokio::runtime::Runtime,
|
||||
rt: Arc<tokio::runtime::Runtime>,
|
||||
}
|
||||
|
||||
pub(crate) fn default_tokio_runtime() -> io::Result<tokio::runtime::Runtime> {
|
||||
pub(crate) fn default_tokio_runtime() -> io::Result<Arc<tokio::runtime::Runtime>> {
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_io()
|
||||
.enable_time()
|
||||
.build()
|
||||
.build().map(Arc::new)
|
||||
}
|
||||
|
||||
impl Runtime {
|
||||
|
@ -141,6 +140,15 @@ impl Runtime {
|
|||
|
||||
impl From<tokio::runtime::Runtime> for Runtime {
|
||||
fn from(rt: tokio::runtime::Runtime) -> Self {
|
||||
Self {
|
||||
local: LocalSet::new(),
|
||||
rt: Arc::new(rt),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Arc<tokio::runtime::Runtime>> for Runtime {
|
||||
fn from(rt: Arc<tokio::runtime::Runtime>) -> Self {
|
||||
Self {
|
||||
local: LocalSet::new(),
|
||||
rt,
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::{
|
|||
io,
|
||||
pin::Pin,
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
use futures_core::ready;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
|
||||
|
@ -48,7 +48,7 @@ impl System {
|
|||
/// [tokio-runtime]: tokio::runtime::Runtime
|
||||
pub fn with_tokio_rt<F>(runtime_factory: F) -> SystemRunner
|
||||
where
|
||||
F: FnOnce() -> tokio::runtime::Runtime,
|
||||
F: FnOnce() -> Arc<tokio::runtime::Runtime>,
|
||||
{
|
||||
let (stop_tx, stop_rx) = oneshot::channel();
|
||||
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
|
||||
|
@ -87,7 +87,7 @@ impl System {
|
|||
#[doc(hidden)]
|
||||
pub fn with_tokio_rt<F>(_: F) -> SystemRunner
|
||||
where
|
||||
F: FnOnce() -> tokio::runtime::Runtime,
|
||||
F: FnOnce() -> Arc<tokio::runtime::Runtime>,
|
||||
{
|
||||
unimplemented!("System::with_tokio_rt is not implemented for io-uring feature yet")
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
|||
use actix_rt::{task::JoinError, Arbiter, System};
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
use {
|
||||
std::{sync::mpsc::channel, thread},
|
||||
std::{sync::Arc, sync::mpsc::channel, thread},
|
||||
tokio::sync::oneshot,
|
||||
};
|
||||
|
||||
|
@ -252,6 +252,7 @@ fn new_system_with_tokio() {
|
|||
.on_thread_start(|| {})
|
||||
.on_thread_stop(|| {})
|
||||
.build()
|
||||
.map(Arc::new)
|
||||
.unwrap()
|
||||
})
|
||||
.block_on(async {
|
||||
|
@ -284,6 +285,7 @@ fn new_arbiter_with_tokio() {
|
|||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.map(Arc::new)
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ actix-utils = "3"
|
|||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||
mio = { version = "1", features = ["os-poll", "net"] }
|
||||
socket2 = "0.5"
|
||||
socket2 = "0.6"
|
||||
tokio = { version = "1.44.2", features = ["sync"] }
|
||||
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
||||
|
||||
|
|
|
@ -425,6 +425,7 @@ impl ServerWorker {
|
|||
.enable_all()
|
||||
.max_blocking_threads(config.max_blocking_threads)
|
||||
.build()
|
||||
.map(Arc::new)
|
||||
.unwrap()
|
||||
})
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue