mirror of https://github.com/fafhrd91/actix-net
Compare commits
3 Commits
704d2fa459
...
473928ad73
| Author | SHA1 | Date |
|---|---|---|
|
|
473928ad73 | |
|
|
3143a2cb73 | |
|
|
192d0661e9 |
|
|
@ -77,7 +77,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-tls"
|
name = "actix-tls"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-codec",
|
"actix-codec",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ fn main() {
|
||||||
.worker_threads(2)
|
.worker_threads(2)
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
|
.map(std::sync::Arc::new)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
})
|
})
|
||||||
.block_on(async_main());
|
.block_on(async_main());
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ impl Arbiter {
|
||||||
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
|
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
|
||||||
pub fn with_tokio_rt<F>(runtime_factory: F) -> Arbiter
|
pub fn with_tokio_rt<F>(runtime_factory: F) -> Arbiter
|
||||||
where
|
where
|
||||||
F: FnOnce() -> tokio::runtime::Runtime + Send + 'static,
|
F: FnOnce() -> std::sync::Arc<tokio::runtime::Runtime> + Send + 'static,
|
||||||
{
|
{
|
||||||
let sys = System::current();
|
let sys = System::current();
|
||||||
let system_id = sys.id();
|
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};
|
use tokio::task::{JoinHandle, LocalSet};
|
||||||
|
|
||||||
/// A Tokio-based runtime proxy.
|
/// A Tokio-based runtime proxy.
|
||||||
|
|
@ -9,14 +8,14 @@ use tokio::task::{JoinHandle, LocalSet};
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Runtime {
|
pub struct Runtime {
|
||||||
local: LocalSet,
|
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()
|
tokio::runtime::Builder::new_current_thread()
|
||||||
.enable_io()
|
.enable_io()
|
||||||
.enable_time()
|
.enable_time()
|
||||||
.build()
|
.build().map(Arc::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Runtime {
|
impl Runtime {
|
||||||
|
|
@ -141,6 +140,15 @@ impl Runtime {
|
||||||
|
|
||||||
impl From<tokio::runtime::Runtime> for Runtime {
|
impl From<tokio::runtime::Runtime> for Runtime {
|
||||||
fn from(rt: tokio::runtime::Runtime) -> Self {
|
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 {
|
Self {
|
||||||
local: LocalSet::new(),
|
local: LocalSet::new(),
|
||||||
rt,
|
rt,
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ use std::{
|
||||||
io,
|
io,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
sync::atomic::{AtomicUsize, Ordering},
|
sync::atomic::{AtomicUsize, Ordering},
|
||||||
|
sync::Arc,
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures_core::ready;
|
use futures_core::ready;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ impl System {
|
||||||
/// [tokio-runtime]: tokio::runtime::Runtime
|
/// [tokio-runtime]: tokio::runtime::Runtime
|
||||||
pub fn with_tokio_rt<F>(runtime_factory: F) -> SystemRunner
|
pub fn with_tokio_rt<F>(runtime_factory: F) -> SystemRunner
|
||||||
where
|
where
|
||||||
F: FnOnce() -> tokio::runtime::Runtime,
|
F: FnOnce() -> Arc<tokio::runtime::Runtime>,
|
||||||
{
|
{
|
||||||
let (stop_tx, stop_rx) = oneshot::channel();
|
let (stop_tx, stop_rx) = oneshot::channel();
|
||||||
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
|
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
|
||||||
|
|
@ -87,7 +87,7 @@ impl System {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn with_tokio_rt<F>(_: F) -> SystemRunner
|
pub fn with_tokio_rt<F>(_: F) -> SystemRunner
|
||||||
where
|
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")
|
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};
|
use actix_rt::{task::JoinError, Arbiter, System};
|
||||||
#[cfg(not(feature = "io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
use {
|
use {
|
||||||
std::{sync::mpsc::channel, thread},
|
std::{sync::Arc, sync::mpsc::channel, thread},
|
||||||
tokio::sync::oneshot,
|
tokio::sync::oneshot,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -252,6 +252,7 @@ fn new_system_with_tokio() {
|
||||||
.on_thread_start(|| {})
|
.on_thread_start(|| {})
|
||||||
.on_thread_stop(|| {})
|
.on_thread_stop(|| {})
|
||||||
.build()
|
.build()
|
||||||
|
.map(Arc::new)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
})
|
})
|
||||||
.block_on(async {
|
.block_on(async {
|
||||||
|
|
@ -284,6 +285,7 @@ fn new_arbiter_with_tokio() {
|
||||||
tokio::runtime::Builder::new_current_thread()
|
tokio::runtime::Builder::new_current_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
|
.map(Arc::new)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -425,6 +425,7 @@ impl ServerWorker {
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.max_blocking_threads(config.max_blocking_threads)
|
.max_blocking_threads(config.max_blocking_threads)
|
||||||
.build()
|
.build()
|
||||||
|
.map(Arc::new)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 3.5.0
|
||||||
|
|
||||||
|
- Update `rustls-native-certs` (`0.7`) dependency to `0.8`.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.76.
|
- Minimum supported Rust version (MSRV) is now 1.76.
|
||||||
|
|
||||||
## 3.4.0
|
## 3.4.0
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "actix-tls"
|
name = "actix-tls"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>", "Rob Ede <robjtede@icloud.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>", "Rob Ede <robjtede@icloud.com>"]
|
||||||
description = "TLS acceptor and connector services for Actix ecosystem"
|
description = "TLS acceptor and connector services for Actix ecosystem"
|
||||||
keywords = ["network", "tls", "ssl", "async", "transport"]
|
keywords = ["network", "tls", "ssl", "async", "transport"]
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-tls)
|
[](https://crates.io/crates/actix-tls)
|
||||||
[](https://docs.rs/actix-tls/3.4.0)
|
[](https://docs.rs/actix-tls/3.5.0)
|
||||||
[](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
[](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
||||||

|

|
||||||
<br />
|
<br />
|
||||||
[](https://deps.rs/crate/actix-tls/3.4.0)
|
[](https://deps.rs/crate/actix-tls/3.5.0)
|
||||||

|

|
||||||
[](https://discord.gg/NWpN5mmg3x)
|
[](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue