summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-03-09 09:47:31 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-03-09 10:44:48 -0300
commitfe44fdcab990e0ee681385aaf65143a60bfaffb7 (patch)
treec3c19e80f9b66aa8bc93ee78cc00684e7991f278
parent0416815cd6f2e33ba8626869442e6a856e5529a1 (diff)
downloadmullvadvpn-fe44fdcab990e0ee681385aaf65143a60bfaffb7.tar.xz
mullvadvpn-fe44fdcab990e0ee681385aaf65143a60bfaffb7.zip
Inline `other_daemon_responds()` function
No need to check if the address file exists before trying to access it.
-rw-r--r--mullvad-daemon/src/rpc_info.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/mullvad-daemon/src/rpc_info.rs b/mullvad-daemon/src/rpc_info.rs
index e4df5ee184..43a573d8bb 100644
--- a/mullvad-daemon/src/rpc_info.rs
+++ b/mullvad-daemon/src/rpc_info.rs
@@ -37,9 +37,12 @@ lazy_static! {
/// Tries to connect to another daemon and perform a simple RPC call. If it fails, assumes the
/// other daemon has stopped.
pub fn is_another_instance_running() -> bool {
- let rpc_file_exists = RPC_ADDRESS_FILE_PATH.as_path().exists();
-
- rpc_file_exists && other_daemon_responds()
+ if let Err(message) = call_other_daemon() {
+ info!("{}; assuming it has stopped", message);
+ false
+ } else {
+ true
+ }
}
/// Writes down the RPC connection info to some API to a file.
@@ -72,15 +75,6 @@ pub fn remove() -> Result<()> {
}
}
-fn other_daemon_responds() -> bool {
- if let Err(message) = call_other_daemon() {
- info!("{}; assuming it has stopped", message);
- false
- } else {
- true
- }
-}
-
fn call_other_daemon() -> result::Result<(), String> {
let method = "get_state";
let args: [u8; 0] = [];