appmgr: sync after deleting hostname

This commit is contained in:
Aiden McClelland
2021-01-18 22:13:18 -07:00
committed by Aiden McClelland
parent f993f19614
commit 25c55ea426
3 changed files with 17 additions and 2 deletions

15
appmgr/Cargo.lock generated
View File

@@ -51,6 +51,7 @@ dependencies = [
"lazy_static", "lazy_static",
"linear-map", "linear-map",
"log", "log",
"nix 0.19.1",
"openssl", "openssl",
"pest", "pest",
"pest_derive", "pest_derive",
@@ -601,7 +602,7 @@ dependencies = [
"gcc", "gcc",
"libc", "libc",
"mktemp", "mktemp",
"nix", "nix 0.11.1",
] ]
[[package]] [[package]]
@@ -1310,6 +1311,18 @@ dependencies = [
"void", "void",
] ]
[[package]]
name = "nix"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
]
[[package]] [[package]]
name = "nom" name = "nom"
version = "4.2.3" version = "4.2.3"

View File

@@ -32,6 +32,7 @@ itertools = "0.9.0"
lazy_static = "1.4" lazy_static = "1.4"
linear-map = { version = "1.2", features = ["serde_impl"] } linear-map = { version = "1.2", features = ["serde_impl"] }
log = "0.4.11" log = "0.4.11"
nix = "0.19.1"
openssl = "0.10.30" openssl = "0.10.30"
pest = "2.1" pest = "2.1"
pest_derive = "2.1" pest_derive = "2.1"

View File

@@ -217,7 +217,7 @@ pub async fn read_tor_key(
version: HiddenServiceVersion, version: HiddenServiceVersion,
timeout: Option<Duration>, timeout: Option<Duration>,
) -> Result<String, Error> { ) -> Result<String, Error> {
log::info!("Retrieving Tor hidden service address for {}.", name); log::info!("Retrieving Tor hidden service key for {}.", name);
let addr_path = Path::new(HIDDEN_SERVICE_DIR_ROOT) let addr_path = Path::new(HIDDEN_SERVICE_DIR_ROOT)
.join(format!("app-{}", name)) .join(format!("app-{}", name))
.join(match version { .join(match version {
@@ -287,6 +287,7 @@ pub async fn set_svc(
Err(e) Err(e)
} }
})?; })?;
nix::unistd::sync();
hidden_services.commit().await?; hidden_services.commit().await?;
log::info!("Reloading Tor."); log::info!("Reloading Tor.");
let svc_exit = std::process::Command::new("service") let svc_exit = std::process::Command::new("service")