mirror of https://github.com/dswd/vpncloud.git
Deleting beacon file at shutdown
This commit is contained in:
parent
0d29293309
commit
f7ed961317
|
@ -8,6 +8,7 @@ This project follows [semantic versioning](http://semver.org).
|
|||
- [changed] Also drop privileges in foreground mode
|
||||
- [changed] Set builders to Ubuntu 16.04 and CentOS 7
|
||||
- [changed] Set keepalive to 120 secs when NAT is detected
|
||||
- [changed] Deleting beacon file at shutdown
|
||||
- [fixed] Added parameter keepalive to manpage
|
||||
- [fixed] Fixed problems on stats file when dropping permissions
|
||||
- [fixed] Deleting files before overwriting them
|
||||
|
|
14
src/cloud.rs
14
src/cloud.rs
|
@ -6,11 +6,12 @@ use std::{
|
|||
cmp::min,
|
||||
collections::HashMap,
|
||||
fmt,
|
||||
fs::File,
|
||||
fs::{self, File},
|
||||
hash::BuildHasherDefault,
|
||||
io::{self, Write},
|
||||
marker::PhantomData,
|
||||
net::{SocketAddr, ToSocketAddrs}
|
||||
net::{SocketAddr, ToSocketAddrs},
|
||||
path::Path
|
||||
};
|
||||
|
||||
use fnv::FnvHasher;
|
||||
|
@ -826,6 +827,15 @@ impl<D: Device, P: Protocol, T: Table, S: Socket, TS: TimeSource> GenericCloud<D
|
|||
}
|
||||
info!("Shutting down...");
|
||||
self.broadcast_msg(&mut Message::Close).ok();
|
||||
if let Some(ref path) = self.config.beacon_store {
|
||||
let path = Path::new(path);
|
||||
if path.exists() {
|
||||
info!("Removing beacon file");
|
||||
if let Err(e) = fs::remove_file(path) {
|
||||
error!("Failed to remove beacon file: {}", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue