diff --git a/Cargo.lock b/Cargo.lock index de71a318f..17eb26e3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,7 +62,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -71,7 +71,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -136,8 +136,9 @@ dependencies = [ [[package]] name = "async-imap" -version = "0.2.0" -source = "git+https://github.com/async-email/async-imap?rev=1e8fdd86dbc99b6d92ab4667b426092060fe8b16#1e8fdd86dbc99b6d92ab4667b426092060fe8b16" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dacff85e0a4ef94b196344a715bfb655d1ec806693d7a566569154b5ea74284" dependencies = [ "async-native-tls", "async-std", @@ -192,40 +193,34 @@ dependencies = [ [[package]] name = "async-std" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "538ecb01eb64eecd772087e5b6f7540cbc917f047727339a472dafed2185b267" +checksum = "a45cee2749d880d7066e328a7e161c7470ced883b2fd000ca4643e9f1dd5083a" dependencies = [ "async-attributes", "async-task", - "broadcaster", - "crossbeam-channel", - "crossbeam-deque", "crossbeam-utils", + "futures-channel", "futures-core", "futures-io", "futures-timer", "kv-log-macro", "log", "memchr", - "mio", - "mio-uds", "num_cpus", "once_cell", "pin-project-lite", "pin-utils", "slab", + "smol", + "wasm-bindgen-futures", ] [[package]] name = "async-task" -version = "1.3.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ac2c016b079e771204030951c366db398864f5026f84a44dafb0ff20f02085d" -dependencies = [ - "libc", - "winapi 0.3.8", -] +checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" [[package]] name = "async-trait" @@ -246,7 +241,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -378,20 +373,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "broadcaster" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c972e21e0d055a36cf73e4daae870941fe7a8abcd5ac3396aab9e4c126bd87" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "futures-util", - "parking_lot", - "slab", -] - [[package]] name = "buf_redux" version = "0.8.4" @@ -601,6 +582,20 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" +dependencies = [ + "cfg-if", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + [[package]] name = "crossbeam-channel" version = "0.4.2" @@ -753,7 +748,6 @@ dependencies = [ "byteorder", "charset", "chrono", - "crossbeam-channel", "debug_stub_derive", "deltachat_derive", "email", @@ -880,7 +874,7 @@ checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" dependencies = [ "libc", "redox_users", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -1135,22 +1129,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.1.29" @@ -1234,9 +1212,13 @@ dependencies = [ [[package]] name = "futures-timer" -version = "2.0.2" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper", +] [[package]] name = "futures-util" @@ -1302,6 +1284,19 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +[[package]] +name = "gloo-timers" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "heck" version = "0.3.1" @@ -1367,9 +1362,9 @@ dependencies = [ [[package]] name = "http-types" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05af75a78dfeb163d472b1d27bebb6a8845917a069accdf53a9bed47aaff9bfc" +checksum = "49d9f44462c2e59d5d5826e7ba74b121ee2fb0ff091ef849692694f1d77aaf50" dependencies = [ "anyhow", "async-std", @@ -1378,6 +1373,8 @@ dependencies = [ "infer", "omnom", "pin-project-lite", + "serde", + "serde_json", "url", ] @@ -1538,16 +1535,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "kv-log-macro" version = "1.0.5" @@ -1739,48 +1726,6 @@ dependencies = [ "adler32", ] -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "native-tls" version = "0.2.4" @@ -1799,17 +1744,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "net2" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.8", -] - [[package]] name = "nix" version = "0.13.1" @@ -1823,6 +1757,19 @@ dependencies = [ "void", ] +[[package]] +name = "nix" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" +dependencies = [ + "bitflags", + "cc", + "cfg-if", + "libc", + "void", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -2016,7 +1963,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2049,7 +1996,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2138,6 +2085,18 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0deb65f46e873ba8aa7c6a8dbe3f23cb1bf59c339a81a1d56361dde4d66ac8" +dependencies = [ + "crossbeam-utils", + "futures-io", + "futures-sink", + "futures-util", +] + [[package]] name = "pkg-config" version = "0.3.17" @@ -2199,9 +2158,9 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de40dd4ff82d9c9bab6dae29dbab1167e515f8df9ed17d2987cb6012db206933" +checksum = "70a50b9351bfa8d65a7d93ce712dc63d2fd15ddbf2c36990fc7cac344859c04f" dependencies = [ "unicode-xid 0.2.0", ] @@ -2302,7 +2261,7 @@ dependencies = [ "libc", "rand_core 0.3.1", "rdrand", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2321,7 +2280,7 @@ dependencies = [ "rand_os", "rand_pcg", "rand_xorshift", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2417,7 +2376,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ "libc", "rand_core 0.4.2", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2431,7 +2390,7 @@ dependencies = [ "libc", "rand_core 0.4.2", "rdrand", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2503,7 +2462,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2620,11 +2579,11 @@ dependencies = [ "libc", "log", "memchr", - "nix", + "nix 0.13.1", "unicode-segmentation", "unicode-width", "utf8parse", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2665,7 +2624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2677,6 +2636,12 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "scoped-tls-hkt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" + [[package]] name = "scopeguard" version = "1.1.0" @@ -2722,6 +2687,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + [[package]] name = "serde" version = "1.0.110" @@ -2830,6 +2801,37 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +[[package]] +name = "smol" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686c634ad1873fffef6aed20f180eede424fbf3bb31802394c90fd7335a661b7" +dependencies = [ + "async-task", + "crossbeam", + "futures-io", + "futures-util", + "nix 0.17.0", + "once_cell", + "piper", + "scoped-tls-hkt", + "slab", + "socket2", + "wepoll-binding", +] + +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi", +] + [[package]] name = "spin" version = "0.5.2" @@ -2981,7 +2983,7 @@ dependencies = [ "rand 0.7.3", "redox_syscall", "remove_dir_all", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -3029,7 +3031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -3195,7 +3197,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi 0.3.8", + "winapi", "winapi-util", ] @@ -3282,10 +3284,23 @@ dependencies = [ ] [[package]] -name = "winapi" -version = "0.2.8" +name = "wepoll-binding" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "7511014d92edaa2cba607fd6dc62974915bebc3e16f91f911a4bb240b4a3a68c" +dependencies = [ + "bitflags", + "wepoll-sys", +] + +[[package]] +name = "wepoll-sys" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9082a777aed991f6769e2b654aa0cb29f1c3d615daf009829b07b66c7aff6a24" +dependencies = [ + "cc", +] [[package]] name = "winapi" @@ -3297,12 +3312,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3315,7 +3324,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -3330,17 +3339,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" dependencies = [ - "winapi 0.3.8", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6591225e3..f77843b51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,9 +23,9 @@ num-traits = "0.2.6" async-smtp = { version = "0.3" } email = { git = "https://github.com/deltachat/rust-email", branch = "master" } lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" } -async-imap = { git = "https://github.com/async-email/async-imap", rev = "1e8fdd86dbc99b6d92ab4667b426092060fe8b16" } -async-native-tls = { version = "0.3.1" } -async-std = { version = "1.5.0", features = ["unstable"] } +async-imap = "0.3.0" +async-native-tls = { version = "0.3.3" } +async-std = { version = "1.6.0", features = ["unstable"] } base64 = "0.11" charset = "0.1" percent-encoding = "2.0" @@ -59,7 +59,6 @@ thiserror = "1.0.14" anyhow = "1.0.28" async-trait = "0.1.31" url = "2.1.1" -crossbeam-channel = "0.4.2" pretty_env_logger = { version = "0.3.1", optional = true } log = {version = "0.4.8", optional = true } @@ -72,7 +71,7 @@ tempfile = "3.0" pretty_assertions = "0.6.1" pretty_env_logger = "0.3.0" proptest = "0.9.4" -async-std = { version = "1.5.0", features = ["unstable", "attributes"] } +async-std = { version = "1.6.0", features = ["unstable", "attributes"] } [workspace] members = [ diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml index 3bd11869f..8fa08fab8 100644 --- a/deltachat-ffi/Cargo.toml +++ b/deltachat-ffi/Cargo.toml @@ -20,7 +20,7 @@ libc = "0.2" human-panic = "1.0.1" num-traits = "0.2.6" serde_json = "1.0" -async-std = "1.5.0" +async-std = "1.6.0" anyhow = "1.0.28" thiserror = "1.0.14" diff --git a/src/events.rs b/src/events.rs index c0e1e5901..156e19348 100644 --- a/src/events.rs +++ b/src/events.rs @@ -1,8 +1,7 @@ //! # Events specification use async_std::path::PathBuf; -use crossbeam_channel::{bounded as channel, Receiver, Sender, TrySendError}; - +use async_std::sync::{channel, Receiver, Sender, TrySendError}; use strum::EnumProperty; use crate::chat::ChatId; @@ -51,13 +50,13 @@ pub struct EventEmitter(Receiver); impl EventEmitter { /// Blocking recv of an event. Return `None` if the `Sender` has been droped. pub fn recv_sync(&self) -> Option { - self.0.recv().ok() + async_std::task::block_on(self.recv()) } /// Blocking async recv of an event. Return `None` if the `Sender` has been droped. pub async fn recv(&self) -> Option { // TODO: change once we can use async channels internally. - self.0.recv().ok() + self.0.recv().await.ok() } } diff --git a/src/scheduler.rs b/src/scheduler.rs index c1c84f193..358beefd0 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -13,6 +13,7 @@ pub(crate) struct StopToken; /// Job and connection scheduler. #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub(crate) enum Scheduler { Stopped, Running { @@ -339,12 +340,15 @@ impl Scheduler { } // wait for all loops to be started - inbox_start_recv + if let Err(err) = inbox_start_recv .recv() - .join(mvbox_start_recv.recv()) - .join(sentbox_start_recv.recv()) - .join(smtp_start_recv.recv()) - .await; + .try_join(mvbox_start_recv.recv()) + .try_join(sentbox_start_recv.recv()) + .try_join(smtp_start_recv.recv()) + .await + { + error!(ctx, "failed to start scheduler: {}", err); + } info!(ctx, "scheduler is running"); } @@ -478,7 +482,7 @@ impl ConnectionState { // Trigger shutdown of the run loop. self.stop_sender.send(()).await; // Wait for a notification that the run loop has been shutdown. - self.shutdown_receiver.recv().await; + self.shutdown_receiver.recv().await.ok(); } async fn interrupt(&self) {