mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-27 15:45:55 -05:00
b41a6c43da
After a frustrating search for a suitable channel to use for shutdown (tokio::sync:⌚:Receiver and futures::future::Shared<tokio::sync::oneshot::Receiver> didn't look quite right) in which I rethought my life decisions, I finally just made my own (server/base/shutdown.rs). We can easily poll it or wait for it in async or sync contexts. Most importantly, it's convenient; not that it really matters here, but it's also efficient. We now do a slightly better job of propagating a "graceful" shutdown signal, and this channel will give us tools to improve it over time. * Shut down even when writer or syncer operations are stuck. Fixes #117 * Not done yet: streamers should instantly shut down without waiting for a connection attempt or frame or something. I'll probably implement that when removing --rtsp-library=ffmpeg. The code should be cleaner then. * Not done yet: fix a couple places that sleep for up to a second when they could shut down immediately. I just need to do the plumbing for mock clocks to work. I also implemented an immediate shutdown mode, activated by a second signal. I think this will mitigate the streamer wait situation.
27 lines
475 B
TOML
27 lines
475 B
TOML
[package]
|
|
name = "moonfire-base"
|
|
version = "0.0.1"
|
|
authors = ["Scott Lamb <slamb@slamb.org>"]
|
|
readme = "../README.md"
|
|
edition = "2018"
|
|
license-file = "../../LICENSE.txt"
|
|
|
|
[features]
|
|
nightly = []
|
|
|
|
[lib]
|
|
path = "lib.rs"
|
|
|
|
[dependencies]
|
|
failure = "0.1.1"
|
|
futures = "0.3"
|
|
lazy_static = "1.0"
|
|
libc = "0.2"
|
|
log = "0.4"
|
|
parking_lot = { version = "0.11.1", features = [] }
|
|
nom = "7.0.0"
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
slab = "0.4"
|
|
time = "0.1"
|