diff --git a/Cargo.lock b/Cargo.lock index c9943a45..79044f9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,18 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -26,6 +38,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "anes" version = "0.1.6" @@ -34,9 +52,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -108,7 +126,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 5.1.0", + "event-listener 5.2.0", "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite", @@ -148,7 +166,7 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.2.0", "async-executor", - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 3.3.0", "blocking", "futures-lite 2.2.0", @@ -177,9 +195,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ "async-lock 3.3.0", "cfg-if", @@ -239,7 +257,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -248,7 +266,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 2.8.0", "atomic-waker", "cfg-if", @@ -305,7 +323,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -322,7 +340,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -489,9 +507,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.3" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "byteorder" @@ -513,9 +531,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.87" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3286b845d0fccbdd15af433f61c5970e711987036cb468f437ff6badd70f4e24" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cfg-if" @@ -573,9 +591,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" dependencies = [ "clap_builder", "clap_derive", @@ -583,9 +601,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", @@ -602,7 +620,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -837,7 +855,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -886,9 +904,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.1.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27" +checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" dependencies = [ "concurrent-queue", "parking", @@ -911,7 +929,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" dependencies = [ - "event-listener 5.1.0", + "event-listener 5.2.0", "pin-project-lite", ] @@ -1024,7 +1042,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -1107,9 +1125,9 @@ dependencies = [ [[package]] name = "half" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" dependencies = [ "cfg-if", "crunchy", @@ -1126,6 +1144,10 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] name = "heck" @@ -1144,9 +1166,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1172,9 +1194,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1195,7 +1217,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.8", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] @@ -1226,9 +1248,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1289,9 +1311,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" dependencies = [ "value-bag", ] @@ -1362,9 +1384,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", @@ -1437,7 +1459,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.8", + "hermit-abi 0.3.9", "libc", ] @@ -1489,7 +1511,7 @@ dependencies = [ "atspi-connection", "atspi-proxies", "circular-queue", - "clap 4.5.1", + "clap 4.5.2", "eyre", "futures", "lazy_static", @@ -1503,6 +1525,7 @@ dependencies = [ "ssip-client-async", "tokio", "tokio-test", + "tokio-util", "tracing", "tracing-error", "tracing-log", @@ -1563,6 +1586,7 @@ dependencies = [ "serde_json", "sysinfo", "tokio", + "tokio-util", "tracing", ] @@ -1588,6 +1612,7 @@ dependencies = [ "eyre", "ssip-client-async", "tokio", + "tokio-util", "tracing", ] @@ -1816,9 +1841,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" dependencies = [ "either", "rayon-core", @@ -1862,7 +1887,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -1877,9 +1902,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1987,7 +2012,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -2018,7 +2043,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -2099,19 +2124,31 @@ dependencies = [ [[package]] name = "ssip-client-async" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61352c73411606e792a5a64467237d29609977e5a7d9b10c564e7516dd703a66" +checksum = "d20c8da60d51225982d675776f18b55c6bd41763b01c03f431190e0ad99c9dbf" dependencies = [ "async-std", "dirs", "log", + "ssip-common", "strum", "strum_macros", "thiserror", "tokio", ] +[[package]] +name = "ssip-common" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7193e9edf18417738259bf590224732d68c1eac3a486dd9ce101b8f9a443e7e4" +dependencies = [ + "strum", + "strum_macros", + "thiserror", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -2156,9 +2193,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.50" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -2191,9 +2228,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand 2.0.1", @@ -2224,7 +2261,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -2299,7 +2336,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -2326,6 +2363,21 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "futures-util", + "hashbrown 0.14.3", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml_datetime" version = "0.6.5" @@ -2338,7 +2390,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.5", "toml_datetime", "winnow", ] @@ -2362,7 +2414,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -2461,9 +2513,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126e423afe2dd9ac52142e7e9d5ce4135d7e13776c529d27fd6bc49f19e3280b" +checksum = "8fec26a25bd6fca441cdd0f769fd7f891bae119f996de31f86a5eddccef54c1d" [[package]] name = "version_check" @@ -2479,9 +2531,9 @@ checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -2495,9 +2547,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2505,24 +2557,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -2532,9 +2584,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2542,28 +2594,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -2634,7 +2686,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -2654,17 +2706,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.3", - "windows_aarch64_msvc 0.52.3", - "windows_i686_gnu 0.52.3", - "windows_i686_msvc 0.52.3", - "windows_x86_64_gnu 0.52.3", - "windows_x86_64_gnullvm 0.52.3", - "windows_x86_64_msvc 0.52.3", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -2675,9 +2727,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -2687,9 +2739,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -2699,9 +2751,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -2711,9 +2763,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -2723,9 +2775,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -2735,9 +2787,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -2747,9 +2799,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winnow" @@ -2784,9 +2836,9 @@ checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "zbus" -version = "3.15.1" +version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5acecd3f8422f198b1a2f954bcc812fe89f3fa4281646f3da1da7925db80085d" +checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6" dependencies = [ "async-broadcast", "async-executor", @@ -2827,9 +2879,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "3.15.1" +version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2207eb71efebda17221a579ca78b45c4c5f116f074eb745c3a172e688ccf89f5" +checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2841,20 +2893,40 @@ dependencies = [ [[package]] name = "zbus_names" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" +checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d" dependencies = [ "serde", "static_assertions", "zvariant", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "zvariant" -version = "3.15.1" +version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b4fcf3660d30fc33ae5cd97e2017b23a96e85afd7a1dd014534cd0bf34ba67" +checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db" dependencies = [ "byteorder", "enumflags2", @@ -2866,9 +2938,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.15.1" +version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0277758a8a0afc0e573e80ed5bfd9d9c2b48bd3108ffe09384f9f738c83f4a55" +checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2879,9 +2951,9 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "1.1.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bedb16a193cc12451873fee2a1bc6550225acece0e36f333e68326c73c8172" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 039a5d69..5c657972 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,8 +42,9 @@ eyre = "0.6.8" nix = "0.26.2" serde_json = "1.0.89" serde = { version = "1.0.194", features = ["derive"] } -ssip-client-async = { default-features = false, features = ["tokio"], version = "0.10.0" } +ssip-client-async = { default-features = false, features = ["tokio"], version = "0.12.0" } tokio = { version = "^1.22.0", default-features = false, features = ["sync", "macros", "rt", "signal", "tracing"] } +tokio-util = { version = "0.7.10", features = ["rt"] } tracing = "^0.1.37" tracing-log = "^0.1.3" tracing-subscriber = { version = "0.3.16", default-features = false, features = ["env-filter", "parking_lot"] } diff --git a/input/Cargo.toml b/input/Cargo.toml index 9475d004..1fd349c7 100644 --- a/input/Cargo.toml +++ b/input/Cargo.toml @@ -20,4 +20,5 @@ once_cell = "1.16.0" serde_json.workspace = true sysinfo = { version = "0.26.8", default_features = false } tokio.workspace = true +tokio-util.workspace=true tracing.workspace = true diff --git a/input/src/lib.rs b/input/src/lib.rs index 5a753945..ac521a22 100644 --- a/input/src/lib.rs +++ b/input/src/lib.rs @@ -18,7 +18,8 @@ use std::{ time::{SystemTime, UNIX_EPOCH}, }; use sysinfo::{ProcessExt, System, SystemExt}; -use tokio::{fs, io::AsyncReadExt, net::UnixListener, sync::broadcast, sync::mpsc::Sender}; +use tokio::{fs, io::AsyncReadExt, net::UnixListener, sync::mpsc::Sender}; +use tokio_util::sync::CancellationToken; fn get_log_file_name() -> String { let time = if let Ok(n) = SystemTime::now().duration_since(UNIX_EPOCH) { @@ -54,7 +55,7 @@ fn get_log_file_name() -> String { /// If there is no way to get access to the directory, then this function will call `exit(1)`; TODO: should probably return a result instead. pub async fn sr_event_receiver( event_sender: Sender, - shutdown_rx: &mut broadcast::Receiver, + shutdown: CancellationToken, ) -> eyre::Result<()> { let (pid_file_path, sock_file_path) = get_file_paths(); let log_file_name = get_log_file_name(); @@ -153,7 +154,7 @@ pub async fn sr_event_receiver( } continue; } - _ = shutdown_rx.recv() => { + () = shutdown.cancelled() => { tracing::debug!("Shutting down input socker."); break; } diff --git a/odilia/Cargo.toml b/odilia/Cargo.toml index fd332057..ef339b56 100644 --- a/odilia/Cargo.toml +++ b/odilia/Cargo.toml @@ -55,6 +55,7 @@ xdg = "2.4.1" zbus.workspace = true odilia-notify = { version = "0.1.0", path = "../odilia-notify" } clap = { version = "4.5.1", features = ["derive"] } +tokio-util.workspace=true [dev-dependencies] lazy_static = "1.4.0" diff --git a/odilia/src/events/mod.rs b/odilia/src/events/mod.rs index 5939dc74..492eb2ca 100644 --- a/odilia/src/events/mod.rs +++ b/odilia/src/events/mod.rs @@ -5,10 +5,8 @@ mod object; use std::{collections::HashMap, sync::Arc}; use futures::stream::StreamExt; -use tokio::sync::{ - broadcast, - mpsc::{Receiver, Sender}, -}; +use tokio::sync::mpsc::{Receiver, Sender}; +use tokio_util::sync::CancellationToken; use crate::state::ScreenReaderState; use atspi_client::{accessible_ext::AccessibleExt, convertable::Convertable}; @@ -66,8 +64,8 @@ pub async fn structural_navigation( pub async fn sr_event( state: Arc, - sr_events: &mut Receiver, - shutdown_rx: &mut broadcast::Receiver, + mut sr_events: Receiver, + shutdown: CancellationToken, ) -> eyre::Result<()> { loop { tokio::select! { @@ -94,7 +92,7 @@ pub async fn sr_event( }; continue; } - _ = shutdown_rx.recv() => { + () = shutdown.cancelled() => { tracing::debug!("sr_event cancelled"); break; } @@ -107,7 +105,7 @@ pub async fn sr_event( pub async fn receive( state: Arc, tx: Sender, - shutdown_rx: &mut broadcast::Receiver, + shutdown: CancellationToken, ) { let events = state.atspi.event_stream(); tokio::pin!(events); @@ -123,7 +121,7 @@ pub async fn receive( } continue; } - _ = shutdown_rx.recv() => { + () = shutdown.cancelled() => { tracing::debug!("receive function is done"); break; } @@ -134,8 +132,8 @@ pub async fn receive( //#[tracing::instrument(level = "debug")] pub async fn process( state: Arc, - rx: &mut Receiver, - shutdown_rx: &mut broadcast::Receiver, + mut rx: Receiver, + shutdown: CancellationToken, ) { loop { tokio::select! { @@ -153,7 +151,7 @@ pub async fn process( }; continue; } - _ = shutdown_rx.recv() => { + () = shutdown.cancelled() => { tracing::debug!("process function is done"); break; } diff --git a/odilia/src/main.rs b/odilia/src/main.rs index 76194dae..53f6f442 100644 --- a/odilia/src/main.rs +++ b/odilia/src/main.rs @@ -13,27 +13,27 @@ mod events; mod logging; mod state; -use std::{process::exit, sync::Arc}; +use std::{process::exit, sync::Arc, time::Duration}; +use crate::cli::Args; +use crate::state::ScreenReaderState; use clap::Parser; use eyre::WrapErr; use futures::{future::FutureExt, StreamExt}; +use odilia_input::sr_event_receiver; +use odilia_notify::listen_to_dbus_notifications; +use ssip_client_async::Priority; use tokio::{ signal::unix::{signal, SignalKind}, - sync::broadcast::{self, error::SendError}, sync::mpsc, + time::timeout, }; - -use crate::cli::Args; -use crate::state::ScreenReaderState; -use odilia_input::sr_event_receiver; -use odilia_notify::listen_to_dbus_notifications; -use ssip_client_async::Priority; +use tokio_util::{sync::CancellationToken, task::TaskTracker}; use atspi_common::events::{document, object}; async fn notifications_monitor( state: Arc, - shutdown_rx: &mut broadcast::Receiver, + shutdown: CancellationToken, ) -> eyre::Result<()> { let mut stream = listen_to_dbus_notifications().await?; loop { @@ -43,7 +43,7 @@ async fn notifications_monitor( format!("new notification: {}, {}.", notification.title, notification.body); state.say(Priority::Important, notification_message).await; }, - _ = shutdown_rx.recv() => { + () = shutdown.cancelled() => { tracing::debug!("Shutting down notification task."); break; }, @@ -51,36 +51,50 @@ async fn notifications_monitor( } Ok(()) } -async fn sigterm_signal_watcher(shutdown_tx: broadcast::Sender) -> eyre::Result<()> { +async fn sigterm_signal_watcher( + token: CancellationToken, + tracker: TaskTracker, +) -> eyre::Result<()> { + let timeout_duration = Duration::from_millis(500); //todo: perhaps take this from the configuration file at some point let mut c = signal(SignalKind::interrupt())?; tracing::debug!("Watching for Ctrl+C"); c.recv().await; tracing::debug!("Asking all processes to stop."); - let _: Result> = shutdown_tx.send(0); + tracing::debug!("cancelling all tokens"); + token.cancel(); + tracing::debug!(?timeout_duration, "waiting for all tasks to finish"); + timeout(timeout_duration, tracker.wait()).await?; + tracing::debug!("All listeners have stopped."); + tracing::debug!("Goodbye, Odilia!"); Ok(()) } #[tokio::main(flavor = "current_thread")] async fn main() -> eyre::Result<()> { let args = Args::parse(); - logging::init(); - // Make sure applications with dynamic accessibility supprt do expose their AT-SPI2 interfaces. + + //initialize the primary token for task cancelation + let token = CancellationToken::new(); + + //initialize a task tracker, which will allow us to wait for all tasks to finish + let tracker = TaskTracker::new(); + + // Make sure applications with dynamic accessibility support do expose their AT-SPI2 interfaces. if let Err(e) = atspi_connection::set_session_accessibility(true).await { tracing::debug!("Could not set AT-SPI2 IsEnabled property because: {}", e); } - let (shutdown_tx, _) = broadcast::channel(1); - let (sr_event_tx, mut sr_event_rx) = mpsc::channel(128); + let (sr_event_tx, sr_event_rx) = mpsc::channel(128); // this channel must NEVER fill up; it will cause the thread receiving events to deadlock due to a zbus design choice. // If you need to make it bigger, then make it bigger, but do NOT let it ever fill up. - let (atspi_event_tx, mut atspi_event_rx) = mpsc::channel(128); + let (atspi_event_tx, atspi_event_rx) = mpsc::channel(128); // this is the chanel which handles all SSIP commands. If SSIP is not allowed to operate on a separate task, then wdaiting for the receiving message can block other long-running operations like structural navigation. // Although in the future, this may possibly be remidied through a proper cache, I think it still makes sense to separate SSIP's IO operations to a separate task. // Like the channel above, it is very important that this is *never* full, since it can cause deadlocking if the other task sending the request is working with zbus. - let (ssip_req_tx, ssip_req_rx) = mpsc::channel::(128); + let (ssip_req_tx, ssip_req_rx) = mpsc::channel::(128); // Initialize state let state = Arc::new(ScreenReaderState::new(ssip_req_tx, args.config.as_deref()).await?); - let mut ssip = odilia_tts::create_ssip_client().await?; + let ssip = odilia_tts::create_ssip_client().await?; if state.say(Priority::Message, "Welcome to Odilia!".to_string()).await { tracing::debug!("Welcome message spoken."); @@ -100,50 +114,32 @@ async fn main() -> eyre::Result<()> { state.add_cache_match_rule(), )?; - let mut shutdown_rx_ssip_recv = shutdown_tx.subscribe(); - let ssip_event_receiver = odilia_tts::handle_ssip_commands( - &mut ssip, - ssip_req_rx, - &mut shutdown_rx_ssip_recv, - ) - .map(|r| r.wrap_err("Could no process SSIP request")); - let mut shutdown_rx_atspi_recv = shutdown_tx.subscribe(); + let ssip_event_receiver = + odilia_tts::handle_ssip_commands(ssip, ssip_req_rx, token.clone()) + .map(|r| r.wrap_err("Could no process SSIP request")); let atspi_event_receiver = - events::receive(Arc::clone(&state), atspi_event_tx, &mut shutdown_rx_atspi_recv) + events::receive(Arc::clone(&state), atspi_event_tx, token.clone()) .map(|()| Ok::<_, eyre::Report>(())); - let mut shutdown_rx_atspi_proc_recv = shutdown_tx.subscribe(); - let atspi_event_processor = events::process( - Arc::clone(&state), - &mut atspi_event_rx, - &mut shutdown_rx_atspi_proc_recv, - ) - .map(|()| Ok::<_, eyre::Report>(())); - let mut shutdown_rx_odilia_recv = shutdown_tx.subscribe(); - let odilia_event_receiver = sr_event_receiver(sr_event_tx, &mut shutdown_rx_odilia_recv) + let atspi_event_processor = + events::process(Arc::clone(&state), atspi_event_rx, token.clone()) + .map(|()| Ok::<_, eyre::Report>(())); + let odilia_event_receiver = sr_event_receiver(sr_event_tx, token.clone()) .map(|r| r.wrap_err("Could not process Odilia events")); - let mut shutdown_rx_odilia_proc_recv = shutdown_tx.subscribe(); - let odilia_event_processor = events::sr_event( - Arc::clone(&state), - &mut sr_event_rx, - &mut shutdown_rx_odilia_proc_recv, - ) - .map(|r| r.wrap_err("Could not process Odilia event")); - let mut shutdown_rx_notif = shutdown_tx.subscribe(); - let notification_task = notifications_monitor(Arc::clone(&state), &mut shutdown_rx_notif) - .map(|r| r.wrap_err("Could not process signal shutdown.")); - let signal_receiver = sigterm_signal_watcher(shutdown_tx) + let odilia_event_processor = + events::sr_event(Arc::clone(&state), sr_event_rx, token.clone()) + .map(|r| r.wrap_err("Could not process Odilia event")); + let notification_task = notifications_monitor(Arc::clone(&state), token.clone()) .map(|r| r.wrap_err("Could not process signal shutdown.")); - tokio::try_join!( - signal_receiver, - atspi_event_receiver, - atspi_event_processor, - odilia_event_receiver, - odilia_event_processor, - ssip_event_receiver, - notification_task, - )?; - tracing::debug!("All listeners have stopped."); - tracing::debug!("Goodbye, Odilia!"); + tracker.spawn(atspi_event_receiver); + tracker.spawn(atspi_event_processor); + tracker.spawn(odilia_event_receiver); + tracker.spawn(odilia_event_processor); + tracker.spawn(ssip_event_receiver); + tracker.spawn(notification_task); + tracker.close(); + let _ = sigterm_signal_watcher(token, tracker) + .await + .wrap_err("can not process interrupt signal"); Ok(()) } diff --git a/odilia/src/state.rs b/odilia/src/state.rs index 44827d31..5497b078 100644 --- a/odilia/src/state.rs +++ b/odilia/src/state.rs @@ -2,7 +2,7 @@ use std::{fs, sync::atomic::AtomicI32}; use circular_queue::CircularQueue; use eyre::WrapErr; -use ssip_client_async::{tokio::Request as SSIPRequest, MessageScope, Priority}; +use ssip_client_async::{MessageScope, Priority, Request as SSIPRequest}; use tokio::sync::{mpsc::Sender, Mutex}; use tracing::debug; use zbus::{fdo::DBusProxy, names::UniqueName, zvariant::ObjectPath, MatchRule, MessageType}; diff --git a/tts/Cargo.toml b/tts/Cargo.toml index 8a56cccb..bd7fce12 100644 --- a/tts/Cargo.toml +++ b/tts/Cargo.toml @@ -13,5 +13,6 @@ edition = "2021" [dependencies] ssip-client-async.workspace = true tokio.workspace = true +tokio-util.workspace=true tracing.workspace = true eyre.workspace = true diff --git a/tts/src/lib.rs b/tts/src/lib.rs index 447366ad..ce4274c4 100644 --- a/tts/src/lib.rs +++ b/tts/src/lib.rs @@ -10,9 +10,7 @@ use eyre::Context; use ssip_client_async::{ - fifo::asynchronous_tokio::Builder, - tokio::{AsyncClient, Request}, - ClientName, + fifo::asynchronous_tokio::Builder, tokio::AsyncClient, ClientName, Request, }; use std::{ io::ErrorKind, @@ -22,8 +20,9 @@ use std::{ use tokio::{ io::{BufReader, BufWriter}, net::unix::{OwnedReadHalf, OwnedWriteHalf}, - sync::{broadcast, mpsc::Receiver}, + sync::mpsc::Receiver, }; +use tokio_util::sync::CancellationToken; /// Creates a new async SSIP client which can be sent commends, and can await responses to. /// # Errors @@ -75,9 +74,9 @@ pub async fn create_ssip_client( /// Errors may also be returned during cleanup via the `shutdown_tx` parameter, since shutting down the connection to speech dispatcher can also potentially error. /// Any of these failures will result in this function exiting with an `Err(_)` variant. pub async fn handle_ssip_commands( - client: &mut AsyncClient, BufWriter>, + mut client: AsyncClient, BufWriter>, requests: Receiver, - shutdown_tx: &mut broadcast::Receiver, + shutdown: CancellationToken, ) -> eyre::Result<()> { tokio::pin!(requests); loop { @@ -91,7 +90,7 @@ pub async fn handle_ssip_commands( tracing::debug!("Response from server: {:#?}", response); } } - _ = shutdown_tx.recv() => { + () = shutdown.cancelled() => { tracing::debug!("Saying goodbye message."); client .send(Request::Speak).await?