diff --git a/Cargo.lock b/Cargo.lock index 1668dee..110b5c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" @@ -206,9 +206,9 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "enclose" @@ -225,48 +225,12 @@ dependencies = [ "instant", ] -[[package]] -name = "futures" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27" -dependencies = [ - "futures-core", - "futures-sink", -] - [[package]] name = "futures-core" version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445" -[[package]] -name = "futures-executor" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - [[package]] name = "futures-io" version = "0.3.18" @@ -288,17 +252,6 @@ dependencies = [ "waker-fn", ] -[[package]] -name = "futures-macro" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "futures-sink" version = "0.3.18" @@ -317,16 +270,10 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e" dependencies = [ - "futures-channel", "futures-core", - "futures-io", - "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", - "slab", ] [[package]] @@ -346,7 +293,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -371,7 +318,7 @@ dependencies = [ "lockfree", "log", "membarrier", - "nix 0.22.0", + "nix 0.22.3", "pin-project-lite", "rlimit", "scoped-tls", @@ -455,9 +402,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -480,9 +427,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.108" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] name = "local-sync" @@ -571,6 +518,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "mio" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + [[package]] name = "miow" version = "0.3.7" @@ -582,25 +541,28 @@ dependencies = [ [[package]] name = "monoio" -version = "0.0.3" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95486b08b357dfe586456169452352790e9c194e95374bf36b18c11a78a0d8" dependencies = [ "bytes", - "futures", "fxhash", "io-uring", "libc", + "mio 0.8.5", "monoio-macros", - "nix 0.23.0", - "os_socketaddr", + "nix 0.25.1", "pin-project-lite", - "pin-utils", "scoped-tls", "socket2 0.4.2", + "windows", ] [[package]] name = "monoio-macros" -version = "0.0.2" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85c9d2114c190b1ec18da29bfbe399a95d81657633b0d2333d4084515aa9f95" dependencies = [ "proc-macro2", "quote", @@ -617,9 +579,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.22.0" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1e25ee6b412c2a1e3fcb6a4499a5c1bfe7f43e014bdce9a6b6666e5aa2d187" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" dependencies = [ "bitflags", "cc", @@ -630,15 +592,16 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ + "autocfg", "bitflags", - "cc", "cfg-if", "libc", "memoffset 0.6.4", + "pin-utils", ] [[package]] @@ -666,16 +629,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" -[[package]] -name = "os_socketaddr" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ff86dee67903f9ffcc3f09712b934761ace77cd34021848a474e7ed7199bd2" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "os_str_bytes" version = "4.2.0" @@ -815,12 +768,6 @@ dependencies = [ "libc", ] -[[package]] -name = "slab" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" - [[package]] name = "smallvec" version = "1.7.0" @@ -893,7 +840,7 @@ dependencies = [ "bytes", "libc", "memchr", - "mio", + "mio 0.7.14", "num_cpus", "once_cell", "parking_lot", @@ -956,9 +903,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicase" @@ -1005,6 +952,12 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "winapi" version = "0.2.8" @@ -1047,3 +1000,75 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0286ba339aa753e70765d521bb0242cc48e1194562bfa2a2ad7ac8a6de28f5d5" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" diff --git a/Cargo.toml b/Cargo.toml index 2060924..6f84946 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,9 @@ members = [ "config" ] +[workspace.dependencies] +monoio = { version = "0.0" } + [profile.release] lto = true debug = false diff --git a/client/Cargo.toml b/client/Cargo.toml index bae467d..f5af6ee 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] config = {path="../config"} -monoio = {path="../../monoio/monoio"} +monoio = { workspace = true } local-sync = "0.0.5" diff --git a/client/src/main.rs b/client/src/main.rs index 1685265..b868bdc 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -46,7 +46,7 @@ CPU slot: {}", let eps_ = eps.clone(); std::thread::spawn(move || { monoio::utils::bind_to_cpu_set(Some(cpu_)).unwrap(); - let mut rt = RuntimeBuilder::new().with_entries(2560).enable_timer().build().unwrap(); + let mut rt = RuntimeBuilder::::new().with_entries(2560).enable_timer().build().unwrap(); rt.block_on(run_thread(count_, eps_, cfg_)); println!("Thread {} finished", cpu_); }); @@ -112,7 +112,7 @@ async fn run_conn( target: String, ) { let mut buf = vec![0; PACKET_SIZE]; - let stream = TcpStream::connect(target).await.unwrap(); + let mut stream = TcpStream::connect(target).await.unwrap(); loop { if let Some(s) = qps_per_conn.as_ref() { diff --git a/monoio-server/Cargo.toml b/monoio-server/Cargo.toml index 39f1a58..7f0c105 100644 --- a/monoio-server/Cargo.toml +++ b/monoio-server/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] config = {path="../config"} -monoio = {path="../../monoio/monoio"} +monoio = { workspace = true } diff --git a/monoio-server/src/main.rs b/monoio-server/src/main.rs index 31f9f6f..5609034 100644 --- a/monoio-server/src/main.rs +++ b/monoio-server/src/main.rs @@ -18,7 +18,7 @@ fn main() { let cpu_ = *cpu as _; let h = std::thread::spawn(move || { monoio::utils::bind_to_cpu_set(Some(cpu_)).unwrap(); - let mut rt = RuntimeBuilder::new() + let mut rt = RuntimeBuilder::::new() .with_entries(32768) .build() .unwrap(); @@ -33,7 +33,7 @@ fn main() { async fn serve(cfg: Arc) { let listener = TcpListener::bind(&cfg.bind).unwrap(); - while let Ok((stream, _)) = listener.accept().await { + while let Ok((mut stream, _)) = listener.accept().await { monoio::spawn(async move { let mut buf = vec![0; PACKET_SIZE]; loop {