Retina 0.3.2, better TEARDOWNs

This commit is contained in:
Scott Lamb 2021-09-29 05:55:12 -07:00
parent 74b9f36a75
commit 095417bb20
4 changed files with 21 additions and 14 deletions

View File

@ -9,6 +9,10 @@ Each release is tagged in Git and on the Docker repository
## unreleased ## unreleased
* trim whitespace when detecting time zone by reading `/etc/timezone`. * trim whitespace when detecting time zone by reading `/etc/timezone`.
* upgrade to Retina 0.33, with better `TEARDOWN` handling
(see [scottlamb/retina#34](https://github.com/scottlamb/retina/34)).
This means faster recovery after an error when using UDP or when the
camera's firmware is based on an old live555 release.
## `v0.6.6` (2021-09-23) ## `v0.6.6` (2021-09-23)

4
server/Cargo.lock generated
View File

@ -1870,9 +1870,9 @@ dependencies = [
[[package]] [[package]]
name = "retina" name = "retina"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819b5befff8af9b03e21256d577d101754527eb981dcd2804cb8725ce1dca978" checksum = "c9d52cea718605a7425537d1859af58d3b1ea669b5572faf481eb6fe7310da17"
dependencies = [ dependencies = [
"base64", "base64",
"bitreader", "bitreader",

View File

@ -46,7 +46,7 @@ nom = "7.0.0"
parking_lot = { version = "0.11.1", features = [] } parking_lot = { version = "0.11.1", features = [] }
protobuf = { git = "https://github.com/stepancheg/rust-protobuf" } protobuf = { git = "https://github.com/stepancheg/rust-protobuf" }
reffers = "0.6.0" reffers = "0.6.0"
retina = "0.3.1" retina = "0.3.2"
ring = "0.16.2" ring = "0.16.2"
rusqlite = "0.25.3" rusqlite = "0.25.3"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View File

@ -116,19 +116,22 @@ where
loop { loop {
let status = self.session_group.stale_sessions(); let status = self.session_group.stale_sessions();
if let Some(max_expires) = status.max_expires { if let Some(max_expires) = status.max_expires {
if let Some(d) = max_expires.checked_duration_since(tokio::time::Instant::now()) { log::info!(
log::info!( "{}: waiting up to {:?} for TEARDOWN or expiration of {} stale sessions",
"{}: Waiting {:?} for {} stale sessions to expire", &self.short_name,
&self.short_name, max_expires.saturating_duration_since(tokio::time::Instant::now()),
d, status.num_sessions
status.num_sessions );
); tokio::runtime::Handle::current().block_on(async {
self.shutdown_rx.wait_for(d)?; tokio::select! {
waited = true; _ = self.session_group.await_stale_sessions(&status) => Ok(()),
} _ = self.shutdown_rx.as_future() => Err(base::shutdown::ShutdownError),
}
})?;
waited = true;
} else { } else {
if waited { if waited {
log::info!("{}: Done waiting", &self.short_name); log::info!("{}: done waiting; no more stale sessions", &self.short_name);
} }
break; break;
} }