diff --git a/gui/Cargo.lock b/gui/Cargo.lock index 16d983f3..cf42e3a5 100644 --- a/gui/Cargo.lock +++ b/gui/Cargo.lock @@ -935,12 +935,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "futures" version = "0.3.21" @@ -1681,7 +1675,6 @@ dependencies = [ "serde_json", "tokio", "toml", - "uds_windows", ] [[package]] @@ -2338,7 +2331,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" dependencies = [ "phf_shared", - "rand 0.8.5", + "rand", ] [[package]] @@ -2472,19 +2465,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.8.5" @@ -2493,7 +2473,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.3", + "rand_core", ] [[package]] @@ -2503,24 +2483,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.3" @@ -2594,15 +2559,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ae028b272a6e99d9f8260ceefa3caa09300a8d6c8d2b2001316474bc52122e9" -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.15" @@ -2640,15 +2596,6 @@ version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "renderdoc-sys" version = "0.7.1" @@ -3049,16 +2996,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "termcolor" version = "1.1.3" @@ -3209,20 +3146,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "rand 0.8.5", + "rand", "static_assertions", ] -[[package]] -name = "uds_windows" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b22bf5f590ee6a2892e134e18482e63361319cc62ed108eb236803284cefec" -dependencies = [ - "tempdir", - "winapi", -] - [[package]] name = "unicode-bidi" version = "0.3.8" diff --git a/gui/Cargo.toml b/gui/Cargo.toml index 8a3c0e6d..751c2670 100644 --- a/gui/Cargo.toml +++ b/gui/Cargo.toml @@ -36,8 +36,5 @@ toml = "0.5" chrono = "0.4" -[target.'cfg(windows)'.dependencies] -uds_windows = "0.1.5" - [dev-dependencies] tokio = {version = "1.9.0", features = ["rt", "macros"]} diff --git a/gui/src/app/error.rs b/gui/src/app/error.rs index 11013c56..f0e767a6 100644 --- a/gui/src/app/error.rs +++ b/gui/src/app/error.rs @@ -31,6 +31,9 @@ impl std::fmt::Display for Error { DaemonError::Start(e) => { write!(f, "Failed to start daemon: {}", e) } + DaemonError::ClientNotSupported => { + write!(f, "Daemon client is not supported") + } DaemonError::Rpc(code, e) => { write!(f, "[{:?}] {}", code, e) } diff --git a/gui/src/app/view/warning.rs b/gui/src/app/view/warning.rs index 9702b2a4..b121ec9e 100644 --- a/gui/src/app/view/warning.rs +++ b/gui/src/app/view/warning.rs @@ -28,6 +28,9 @@ impl From<&Error> for WarningMessage { } DaemonError::Unexpected(_) => WarningMessage("Unknown error".to_string()), DaemonError::Start(_) => WarningMessage("Daemon failed to start".to_string()), + DaemonError::ClientNotSupported => { + WarningMessage("Daemon client is not supported".to_string()) + } DaemonError::NoAnswer | DaemonError::Transport(..) => { WarningMessage("Communication with Daemon failed".to_string()) } diff --git a/gui/src/daemon/client/jsonrpc.rs b/gui/src/daemon/client/jsonrpc.rs index 5dd6df51..fc600c04 100644 --- a/gui/src/daemon/client/jsonrpc.rs +++ b/gui/src/daemon/client/jsonrpc.rs @@ -18,9 +18,6 @@ //! and parsing responses //! -#[cfg(windows)] -use uds_windows::UnixStream; - #[cfg(not(windows))] use std::os::unix::net::UnixStream; @@ -70,7 +67,17 @@ impl JsonRPCClient { self.timeout = timeout; } + #[cfg(windows)] + pub fn send_request( + &self, + method: &str, + params: Option, + ) -> Result, Error> { + Err(Error::NotSupported) + } + /// Sends a request to a client + #[cfg(not(windows))] pub fn send_request( &self, method: &str, @@ -185,6 +192,8 @@ pub enum Error { NonceMismatch, /// Response to a request had a jsonrpc field other than "2.0" VersionMismatch, + /// unix socket communication is not supported. + NotSupported, } impl From for Error { @@ -214,6 +223,7 @@ impl fmt::Display for Error { Error::NoErrorOrResult => write!(f, "Malformed RPC response"), Error::NonceMismatch => write!(f, "Nonce of response did not match nonce of request"), Error::VersionMismatch => write!(f, "`jsonrpc` field set to non-\"2.0\""), + Error::NotSupported => write!(f, "unix socket communication is not supported"), } } } @@ -239,6 +249,7 @@ impl From for super::DaemonError { super::DaemonError::Transport(None, format!("transport: {}", e)) } Error::NoErrorOrResult => super::DaemonError::NoAnswer, + Error::NotSupported => super::DaemonError::ClientNotSupported, Error::Rpc(e) => super::DaemonError::Rpc(e.code, e.message), } } diff --git a/gui/src/daemon/mod.rs b/gui/src/daemon/mod.rs index e7db4b71..41c68cdf 100644 --- a/gui/src/daemon/mod.rs +++ b/gui/src/daemon/mod.rs @@ -24,6 +24,8 @@ pub enum DaemonError { NoAnswer, // Error at start up. Start(StartupError), + // Error if the client is not supported. + ClientNotSupported, } impl std::fmt::Display for DaemonError { @@ -34,6 +36,7 @@ impl std::fmt::Display for DaemonError { Self::Transport(kind, e) => write!(f, "Daemon transport error: [{:?}] {}", kind, e), Self::Unexpected(e) => write!(f, "Daemon unexpected error: {}", e), Self::Start(e) => write!(f, "Daemon did not start: {}", e), + Self::ClientNotSupported => write!(f, "Daemon communication is not supported"), } } } diff --git a/gui/src/loader.rs b/gui/src/loader.rs index 83a75889..854dfd34 100644 --- a/gui/src/loader.rs +++ b/gui/src/loader.rs @@ -96,7 +96,8 @@ impl Loader { Error::Config(_) => { self.step = Step::Error(Box::new(e)); } - Error::Daemon(DaemonError::Transport(Some(ErrorKind::ConnectionRefused), _)) + Error::Daemon(DaemonError::ClientNotSupported) + | Error::Daemon(DaemonError::Transport(Some(ErrorKind::ConnectionRefused), _)) | Error::Daemon(DaemonError::Transport(Some(ErrorKind::NotFound), _)) => { self.step = Step::StartingDaemon; self.daemon_started = true;