Merge branch 'fix-async-std' into 'main'
fix compilation error with async-std See merge request tpo/core/arti!723
This commit is contained in:
commit
d9c140992f
|
@ -103,6 +103,7 @@ dependencies = [
|
||||||
"secmem-proc",
|
"secmem-proc",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"signal-hook",
|
||||||
"signal-hook-async-std",
|
"signal-hook-async-std",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml",
|
"toml",
|
||||||
|
|
|
@ -21,6 +21,7 @@ async-std = [
|
||||||
"tor-rtcompat/async-std",
|
"tor-rtcompat/async-std",
|
||||||
"async-ctrlc",
|
"async-ctrlc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"signal-hook",
|
||||||
"signal-hook-async-std",
|
"signal-hook-async-std",
|
||||||
]
|
]
|
||||||
dns-proxy = ["trust-dns-proto"]
|
dns-proxy = ["trust-dns-proto"]
|
||||||
|
@ -61,6 +62,7 @@ rlimit = "0.8.3"
|
||||||
safelog = { path = "../safelog", version = "0.1.0" }
|
safelog = { path = "../safelog", version = "0.1.0" }
|
||||||
secmem-proc = { version = "0.1.1", optional = true }
|
secmem-proc = { version = "0.1.1", optional = true }
|
||||||
serde = { version = "1.0.103", features = ["derive"] }
|
serde = { version = "1.0.103", features = ["derive"] }
|
||||||
|
signal-hook = { version = "0.3", optional = true }
|
||||||
signal-hook-async-std = { version = "0.2", optional = true }
|
signal-hook-async-std = { version = "0.2", optional = true }
|
||||||
tokio-crate = { package = "tokio", version = "1.7", optional = true, features = ["signal"] }
|
tokio-crate = { package = "tokio", version = "1.7", optional = true, features = ["signal"] }
|
||||||
tor-config = { path = "../tor-config", version = "0.6.0" }
|
tor-config = { path = "../tor-config", version = "0.6.0" }
|
||||||
|
|
|
@ -88,9 +88,10 @@ pub(crate) fn sighup_stream() -> crate::Result<impl futures::Stream<Item = ()>>
|
||||||
Ok(futures::stream::poll_fn(move |ctx| signal.poll_recv(ctx)))
|
Ok(futures::stream::poll_fn(move |ctx| signal.poll_recv(ctx)))
|
||||||
} else if #[cfg(all(feature="async-std", target_family = "unix"))] {
|
} else if #[cfg(all(feature="async-std", target_family = "unix"))] {
|
||||||
use signal_hook_async_std as s;
|
use signal_hook_async_std as s;
|
||||||
|
use signal_hook::consts::signal;
|
||||||
use futures::stream::StreamExt as _;
|
use futures::stream::StreamExt as _;
|
||||||
let mut signal = s::Signals::new(&[s::consts::signals::SIGHUP])?;
|
let signal = s::Signals::new(&[signal::SIGHUP])?;
|
||||||
Ok(signals.map(|i| i*2))
|
Ok(signal.map(|_| ()))
|
||||||
} else {
|
} else {
|
||||||
// Not unix or no backend, so we won't ever get a SIGHUP.
|
// Not unix or no backend, so we won't ever get a SIGHUP.
|
||||||
Ok(futures::stream::pending())
|
Ok(futures::stream::pending())
|
||||||
|
|
Loading…
Reference in New Issue