Write notification.xml to new file, then rename #352

This commit is contained in:
Tim Bruijnzeels
2020-12-10 15:58:46 +01:00
parent 0f54bf73ef
commit cae5dda52c
+9 -1
View File
@@ -311,8 +311,10 @@ impl RrdpServer {
}
// something changed, update notification file
let notification_path_new = self.notification_path_new();
let notification_path = self.notification_path();
self.notification.write_xml(&notification_path)?;
self.notification.write_xml(&notification_path_new)?;
fs::rename(notification_path_new, notification_path)?;
// clean up under the base dir:
// - old session dirs
@@ -401,6 +403,12 @@ impl RrdpServer {
// Cannot fail. Config checked at startup.
}
fn notification_path_new(&self) -> PathBuf {
let mut path = self.rrdp_base_dir.clone();
path.push("new-notification.xml");
path
}
fn notification_path(&self) -> PathBuf {
let mut path = self.rrdp_base_dir.clone();
path.push("notification.xml");