diff --git a/Cargo.lock b/Cargo.lock index 5f794414a..9277e87b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,6 +103,7 @@ dependencies = [ "secmem-proc", "serde", "serde_json", + "signal-hook", "signal-hook-async-std", "tokio", "toml", diff --git a/crates/arti/Cargo.toml b/crates/arti/Cargo.toml index e3c45c29a..bbedb0fc9 100644 --- a/crates/arti/Cargo.toml +++ b/crates/arti/Cargo.toml @@ -21,6 +21,7 @@ async-std = [ "tor-rtcompat/async-std", "async-ctrlc", "once_cell", + "signal-hook", "signal-hook-async-std", ] dns-proxy = ["trust-dns-proto"] @@ -61,6 +62,7 @@ rlimit = "0.8.3" safelog = { path = "../safelog", version = "0.1.0" } secmem-proc = { version = "0.1.1", optional = true } serde = { version = "1.0.103", features = ["derive"] } +signal-hook = { version = "0.3", optional = true } signal-hook-async-std = { version = "0.2", optional = true } tokio-crate = { package = "tokio", version = "1.7", optional = true, features = ["signal"] } tor-config = { path = "../tor-config", version = "0.6.0" } diff --git a/crates/arti/src/process.rs b/crates/arti/src/process.rs index 2fd5b16de..7f5c557bd 100644 --- a/crates/arti/src/process.rs +++ b/crates/arti/src/process.rs @@ -88,9 +88,10 @@ pub(crate) fn sighup_stream() -> crate::Result> Ok(futures::stream::poll_fn(move |ctx| signal.poll_recv(ctx))) } else if #[cfg(all(feature="async-std", target_family = "unix"))] { use signal_hook_async_std as s; + use signal_hook::consts::signal; use futures::stream::StreamExt as _; - let mut signal = s::Signals::new(&[s::consts::signals::SIGHUP])?; - Ok(signals.map(|i| i*2)) + let signal = s::Signals::new(&[signal::SIGHUP])?; + Ok(signal.map(|_| ())) } else { // Not unix or no backend, so we won't ever get a SIGHUP. Ok(futures::stream::pending())