summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2021-03-04 19:21:29 +0000
committerEmīls Piņķis <emils@mullvad.net>2021-03-08 11:50:45 +0000
commit2d64b2fe9bc1c93c4d54a544d4959936e70297ac (patch)
tree216ad50074e28b548ed8e2dca3c4d6d4b02a778a
parent030238c6aa3d07d68974a738bc73e16c6dce0110 (diff)
downloadmullvadvpn-2d64b2fe9bc1c93c4d54a544d4959936e70297ac.tar.xz
mullvadvpn-2d64b2fe9bc1c93c4d54a544d4959936e70297ac.zip
Remove old RPC socket
Remove old RPC socket in the case that no other daemon instance exists.
-rw-r--r--mullvad-daemon/src/main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index 4e055183b9..199fa84152 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -98,6 +98,13 @@ async fn run_standalone(log_dir: Option<PathBuf>) -> Result<(), String> {
return Err("Another instance of the daemon is already running".to_owned());
}
+ #[cfg(not(windows))]
+ if let Err(err) = tokio::fs::remove_file(mullvad_paths::get_rpc_socket_path()).await {
+ if err.kind() != std::io::ErrorKind::NotFound {
+ log::error!("Failed to remove old RPC socket: {}", err);
+ }
+ }
+
if !running_as_admin() {
warn!("Running daemon as a non-administrator user, clients might refuse to connect");
}