Skip to content

Commit a08f3a5

Browse files
committed
Merge branch 'uniqueness-check-before-logrotate' into main
2 parents e7eacb9 + f60a9c9 commit a08f3a5

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Line wrap the file at 100 chars. Th
3838
### Fixed
3939
- Continual excessive attempts to update the API IP were made after testing access methods.
4040
- Fix pointless API access method rotations for concurrent requests.
41+
- Fix daemon rotating logs on startup even if another daemon is already running.
4142

4243
### Security
4344
#### Android

mullvad-daemon/src/main.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,24 @@ const EARLY_BOOT_LOG_FILENAME: &str = "early-boot-fw.log";
2323

2424
fn main() {
2525
let config = cli::get_config();
26+
27+
let runtime = new_runtime_builder().build().unwrap_or_else(|error| {
28+
eprintln!("{}", error.display_chain());
29+
std::process::exit(1);
30+
});
31+
32+
if runtime.block_on(rpc_uniqueness_check::is_another_instance_running()) {
33+
eprintln!("Another instance of the daemon is already running");
34+
std::process::exit(1)
35+
}
36+
2637
let log_dir = init_daemon_logging(config).unwrap_or_else(|error| {
2738
eprintln!("{error}");
2839
std::process::exit(1)
2940
});
3041

3142
log::trace!("Using configuration: {:?}", config);
3243

33-
let runtime = new_runtime_builder().build().unwrap_or_else(|error| {
34-
eprintln!("{}", error.display_chain());
35-
std::process::exit(1);
36-
});
37-
3844
let exit_code = match runtime.block_on(run_platform(config, log_dir)) {
3945
Ok(_) => 0,
4046
Err(error) => {
@@ -144,10 +150,6 @@ async fn run_platform(_config: &cli::Config, log_dir: Option<PathBuf>) -> Result
144150
}
145151

146152
async fn run_standalone(log_dir: Option<PathBuf>) -> Result<(), String> {
147-
if rpc_uniqueness_check::is_another_instance_running().await {
148-
return Err("Another instance of the daemon is already running".to_owned());
149-
}
150-
151153
#[cfg(any(target_os = "macos", target_os = "linux"))]
152154
if let Err(err) = tokio::fs::remove_file(mullvad_paths::get_rpc_socket_path()).await {
153155
if err.kind() != std::io::ErrorKind::NotFound {

0 commit comments

Comments
 (0)