mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 22:51:07 +01:00
update tokio-uring to 0.3 (#448)
This commit is contained in:
parent
c5d6174cec
commit
3e132d2bc6
@ -1,8 +1,14 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2022-xx-xx
|
## Unreleased - 2022-xx-xx
|
||||||
|
|
||||||
|
|
||||||
|
## 2.7.0 - 2022-03-08
|
||||||
|
- Update `tokio-uring` dependency to `0.3.0`. [#448]
|
||||||
- Minimum supported Rust version (MSRV) is now 1.49.
|
- Minimum supported Rust version (MSRV) is now 1.49.
|
||||||
|
|
||||||
|
[#448]: https://github.com/actix/actix-net/pull/448
|
||||||
|
|
||||||
|
|
||||||
## 2.6.0 - 2022-01-12
|
## 2.6.0 - 2022-01-12
|
||||||
- Update `tokio-uring` dependency to `0.2.0`. [#436]
|
- Update `tokio-uring` dependency to `0.2.0`. [#436]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-rt"
|
name = "actix-rt"
|
||||||
version = "2.6.0"
|
version = "2.7.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
@ -29,7 +29,7 @@ actix-macros = { version = "0.2.3", optional = true }
|
|||||||
futures-core = { version = "0.3", default-features = false }
|
futures-core = { version = "0.3", default-features = false }
|
||||||
tokio = { version = "1.13.1", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }
|
tokio = { version = "1.13.1", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }
|
||||||
|
|
||||||
# runtime for io-uring feature
|
# runtime for `io-uring` feature
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
tokio-uring = { version = "0.3", optional = true }
|
tokio-uring = { version = "0.3", optional = true }
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
> Tokio-based single-threaded async runtime for the Actix ecosystem.
|
> Tokio-based single-threaded async runtime for the Actix ecosystem.
|
||||||
|
|
||||||
[![crates.io](https://img.shields.io/crates/v/actix-rt?label=latest)](https://crates.io/crates/actix-rt)
|
[![crates.io](https://img.shields.io/crates/v/actix-rt?label=latest)](https://crates.io/crates/actix-rt)
|
||||||
[![Documentation](https://docs.rs/actix-rt/badge.svg?version=2.6.0)](https://docs.rs/actix-rt/2.6.0)
|
[![Documentation](https://docs.rs/actix-rt/badge.svg?version=2.7.0)](https://docs.rs/actix-rt/2.7.0)
|
||||||
[![Version](https://img.shields.io/badge/rustc-1.46+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
|
[![Version](https://img.shields.io/badge/rustc-1.46+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
|
||||||
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-rt.svg)
|
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-rt.svg)
|
||||||
<br />
|
<br />
|
||||||
[![dependency status](https://deps.rs/crate/actix-rt/2.6.0/status.svg)](https://deps.rs/crate/actix-rt/2.6.0)
|
[![dependency status](https://deps.rs/crate/actix-rt/2.7.0/status.svg)](https://deps.rs/crate/actix-rt/2.7.0)
|
||||||
![Download](https://img.shields.io/crates/d/actix-rt.svg)
|
![Download](https://img.shields.io/crates/d/actix-rt.svg)
|
||||||
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/WghFtEH6Hb)
|
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/WghFtEH6Hb)
|
||||||
|
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2022-xx-xx
|
## Unreleased - 2022-xx-xx
|
||||||
|
|
||||||
|
|
||||||
|
## 2.1.0 - 2022-03-08
|
||||||
|
- Update `tokio-uring` dependency to `0.3.0`. [#448]
|
||||||
|
- Logs emitted now use the `tracing` crate with `log` compatibility. [#448]
|
||||||
- Wait for accept thread to stop before sending completion signal. [#443]
|
- Wait for accept thread to stop before sending completion signal. [#443]
|
||||||
|
|
||||||
[#443]: https://github.com/actix/actix-net/pull/443
|
[#443]: https://github.com/actix/actix-net/pull/443
|
||||||
|
[#448]: https://github.com/actix/actix-net/pull/448
|
||||||
|
|
||||||
|
|
||||||
## 2.0.0 - 2022-01-19
|
## 2.0.0 - 2022-01-19
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-server"
|
name = "actix-server"
|
||||||
version = "2.0.0"
|
version = "2.1.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"fakeshadow <24548779@qq.com>",
|
"fakeshadow <24548779@qq.com>",
|
||||||
@ -24,9 +24,9 @@ default = []
|
|||||||
io-uring = ["tokio-uring", "actix-rt/io-uring"]
|
io-uring = ["tokio-uring", "actix-rt/io-uring"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = { version = "2.6.0", default-features = false }
|
actix-rt = { version = "2.7", default-features = false }
|
||||||
actix-service = "2.0.0"
|
actix-service = "2"
|
||||||
actix-utils = "3.0.0"
|
actix-utils = "3"
|
||||||
|
|
||||||
futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] }
|
futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] }
|
||||||
futures-util = { version = "0.3.7", default-features = false, features = ["alloc"] }
|
futures-util = { version = "0.3.7", default-features = false, features = ["alloc"] }
|
||||||
@ -36,7 +36,7 @@ socket2 = "0.4.2"
|
|||||||
tokio = { version = "1.13.1", features = ["sync"] }
|
tokio = { version = "1.13.1", features = ["sync"] }
|
||||||
tracing = { version = "0.1.30", features = ["log"] }
|
tracing = { version = "0.1.30", features = ["log"] }
|
||||||
|
|
||||||
# runtime for io-uring feature
|
# runtime for `io-uring` feature
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
tokio-uring = { version = "0.3", optional = true }
|
tokio-uring = { version = "0.3", optional = true }
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
> General purpose TCP server built for the Actix ecosystem.
|
> General purpose TCP server built for the Actix ecosystem.
|
||||||
|
|
||||||
[![crates.io](https://img.shields.io/crates/v/actix-server?label=latest)](https://crates.io/crates/actix-server)
|
[![crates.io](https://img.shields.io/crates/v/actix-server?label=latest)](https://crates.io/crates/actix-server)
|
||||||
[![Documentation](https://docs.rs/actix-server/badge.svg?version=2.0.0)](https://docs.rs/actix-server/2.0.0)
|
[![Documentation](https://docs.rs/actix-server/badge.svg?version=2.1.0)](https://docs.rs/actix-server/2.1.0)
|
||||||
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
||||||
![License](https://img.shields.io/crates/l/actix-server.svg)
|
![License](https://img.shields.io/crates/l/actix-server.svg)
|
||||||
[![Dependency Status](https://deps.rs/crate/actix-server/2.0.0/status.svg)](https://deps.rs/crate/actix-server/2.0.0)
|
[![Dependency Status](https://deps.rs/crate/actix-server/2.1.0/status.svg)](https://deps.rs/crate/actix-server/2.1.0)
|
||||||
![Download](https://img.shields.io/crates/d/actix-server.svg)
|
![Download](https://img.shields.io/crates/d/actix-server.svg)
|
||||||
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
|
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
@ -39,8 +39,10 @@ async fn run() -> io::Result<()> {
|
|||||||
// wait for next line
|
// wait for next line
|
||||||
match framed.next().await {
|
match framed.next().await {
|
||||||
Some(Ok(line)) => {
|
Some(Ok(line)) => {
|
||||||
match File::open(line).await {
|
match File::open(&line).await {
|
||||||
Ok(mut file) => {
|
Ok(mut file) => {
|
||||||
|
tracing::info!("reading file: {}", &line);
|
||||||
|
|
||||||
// read file into String buffer
|
// read file into String buffer
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
file.read_to_string(&mut buf).await?;
|
file.read_to_string(&mut buf).await?;
|
||||||
|
@ -23,7 +23,6 @@ use actix_service::{fn_service, ServiceFactoryExt as _};
|
|||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use futures_util::future::ok;
|
use futures_util::future::ok;
|
||||||
use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _};
|
use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _};
|
||||||
use tracing::{error, info};
|
|
||||||
|
|
||||||
async fn run() -> io::Result<()> {
|
async fn run() -> io::Result<()> {
|
||||||
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
|
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
|
||||||
@ -31,7 +30,7 @@ async fn run() -> io::Result<()> {
|
|||||||
let count = Arc::new(AtomicUsize::new(0));
|
let count = Arc::new(AtomicUsize::new(0));
|
||||||
|
|
||||||
let addr = ("127.0.0.1", 8080);
|
let addr = ("127.0.0.1", 8080);
|
||||||
info!("starting server on port: {}", &addr.0);
|
tracing::info!("starting server on port: {}", &addr.0);
|
||||||
|
|
||||||
// Bind socket address and start worker(s). By default, the server uses the number of physical
|
// Bind socket address and start worker(s). By default, the server uses the number of physical
|
||||||
// CPU cores as the worker count. For this reason, the closure passed to bind needs to return
|
// CPU cores as the worker count. For this reason, the closure passed to bind needs to return
|
||||||
@ -58,14 +57,14 @@ async fn run() -> io::Result<()> {
|
|||||||
|
|
||||||
// more bytes to process
|
// more bytes to process
|
||||||
Ok(bytes_read) => {
|
Ok(bytes_read) => {
|
||||||
info!("[{}] read {} bytes", num, bytes_read);
|
tracing::info!("[{}] read {} bytes", num, bytes_read);
|
||||||
stream.write_all(&buf[size..]).await.unwrap();
|
stream.write_all(&buf[size..]).await.unwrap();
|
||||||
size += bytes_read;
|
size += bytes_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stream error; bail from loop with error
|
// stream error; bail from loop with error
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("Stream Error: {:?}", err);
|
tracing::error!("Stream Error: {:?}", err);
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,10 +74,10 @@ async fn run() -> io::Result<()> {
|
|||||||
Ok((buf.freeze(), size))
|
Ok((buf.freeze(), size))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map_err(|err| error!("Service Error: {:?}", err))
|
.map_err(|err| tracing::error!("Service Error: {:?}", err))
|
||||||
.and_then(move |(_, size)| {
|
.and_then(move |(_, size)| {
|
||||||
let num = num2.load(Ordering::SeqCst);
|
let num = num2.load(Ordering::SeqCst);
|
||||||
info!("[{}] total bytes read: {}", num, size);
|
tracing::info!("[{}] total bytes read: {}", num, size);
|
||||||
ok(size)
|
ok(size)
|
||||||
})
|
})
|
||||||
})?
|
})?
|
||||||
|
Loading…
Reference in New Issue
Block a user