summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-07-16 09:39:46 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-07-17 14:26:20 +0200
commit0c8617be19a7b624f69bdee13fc783561c1accc4 (patch)
tree44de0642d7f6862e1d29f40e525fe17919c1c548
parenta388b166c6617fb6899a3d6156f481fbc1ae0bdb (diff)
downloadmullvadvpn-0c8617be19a7b624f69bdee13fc783561c1accc4.tar.xz
mullvadvpn-0c8617be19a7b624f69bdee13fc783561c1accc4.zip
Simplify is_another_instance_running
-rw-r--r--mullvad-daemon/src/rpc_uniqueness_check.rs23
-rw-r--r--talpid-openvpn-plugin/src/processing.rs2
2 files changed, 10 insertions, 15 deletions
diff --git a/mullvad-daemon/src/rpc_uniqueness_check.rs b/mullvad-daemon/src/rpc_uniqueness_check.rs
index 96f1e9c15c..76130f72e8 100644
--- a/mullvad-daemon/src/rpc_uniqueness_check.rs
+++ b/mullvad-daemon/src/rpc_uniqueness_check.rs
@@ -1,5 +1,6 @@
use error_chain::ChainedError;
+use log::Level;
use mullvad_ipc_client::DaemonRpcClient;
@@ -9,21 +10,15 @@ use mullvad_ipc_client::DaemonRpcClient;
/// other daemon has stopped.
pub fn is_another_instance_running() -> bool {
match DaemonRpcClient::new() {
- Ok(mut client) => match client.get_state() {
- Ok(_) => true,
- Err(error) => {
- let chained_error = error.chain_err(|| {
- "Failed to communicate with another daemon instance, assuming it has stopped"
- });
- info!("{}", chained_error.display_chain());
- false
- }
- },
+ Ok(_) => true,
Err(error) => {
- let chained_error = error.chain_err(|| {
- "Failed to load RPC address for another daemon instance, assuming there isn't one"
- });
- debug!("{}", chained_error.display_chain());
+ let msg =
+ "Failed to locate/connect to another daemon instance, assuming there isn't one";
+ if log_enabled!(Level::Debug) {
+ debug!("{}\n{}", msg, error.display_chain());
+ } else {
+ info!("{}", msg);
+ }
false
}
}
diff --git a/talpid-openvpn-plugin/src/processing.rs b/talpid-openvpn-plugin/src/processing.rs
index cadaf80647..0d041939c4 100644
--- a/talpid-openvpn-plugin/src/processing.rs
+++ b/talpid-openvpn-plugin/src/processing.rs
@@ -8,7 +8,7 @@ use super::Arguments;
error_chain! {
errors {
AuthDenied {
- description("Authentication failed with Talpid Core IPC server")
+ description("Failed to authenticate with Talpid IPC server")
}
IpcSendingError {
description("Failed while sending an event over the IPC channel")