CLippy and build fixes
This commit is contained in:
3 files changed
+9
-7
No files matched your search
@@ -90,7 +90,7 @@ impl NeoReactor {
|
||||
},
|
||||
NeoReactorCommand::UpdateConfig(new_conf, reply) => {
|
||||
// Shutdown or Notify instances of a change
|
||||
let mut names = new_conf.cameras.iter().filter_map(|cam_conf| cam_conf.enabled.then(|| (cam_conf.name.clone(), cam_conf.clone()))).collect::<HashMap<_,_>>();
|
||||
let mut names = new_conf.cameras.iter().filter(|cam_conf| cam_conf.enabled).map(|cam_conf| (cam_conf.name.clone(), cam_conf.clone())).collect::<HashMap<_,_>>();
|
||||
// Remove those no longer in the config
|
||||
instances.retain(|name, _| names.contains_key(name));
|
||||
for (name, instance) in instances.iter() {
|
||||
|
||||
@@ -44,7 +44,7 @@ impl NeoRtspServer {
|
||||
let factory = Object::new::<NeoRtspServer>();
|
||||
|
||||
// Setup auth
|
||||
let auth = factory.auth().unwrap_or_else(RTSPAuth::new);
|
||||
let auth = factory.auth().unwrap_or_default();
|
||||
auth.set_supported_methods(RTSPAuthMethod::Basic);
|
||||
let mut un_authtoken = RTSPToken::new(&[
|
||||
//RTSP_TOKEN_MEDIA_FACTORY_ROLE: Means look inside the media factory settings and use the same permissions this user (`"anonymous"`) has
|
||||
@@ -139,7 +139,7 @@ impl NeoRtspServerImpl {
|
||||
client_auth: TlsAuthenticationMode,
|
||||
) -> AnyResult<()> {
|
||||
debug!("Setting up TLS using {}", cert_file);
|
||||
let auth = self.obj().auth().unwrap_or_else(RTSPAuth::new);
|
||||
let auth = self.obj().auth().unwrap_or_default();
|
||||
|
||||
// We seperate reading the file and changing to a PEM so that we get different error messages.
|
||||
let cert_contents = fs::read_to_string(cert_file).with_context(|| "TLS file not found")?;
|
||||
|
||||
+6
-4
@@ -588,16 +588,17 @@ async fn stream_main(
|
||||
let mut curr_pn = None;
|
||||
let mut client_activator = stream_instance.activator_handle().await;
|
||||
client_activator.deactivate().await?;
|
||||
let thread_name = name.clone();
|
||||
set.spawn(async move {
|
||||
loop {
|
||||
curr_pn = pn
|
||||
.wait_for(|pn| pn != curr_pn && pn.is_some())
|
||||
.wait_for(|pn| pn != &curr_pn && pn.is_some())
|
||||
.await?
|
||||
.clone();
|
||||
log::info!("{}: Enabling Push Notification", thread_name);
|
||||
client_activator.activate().await?;
|
||||
tokio::select! {
|
||||
v = pn.wait_for(|pn| pn != curr_pn && pn.is_some()) => {
|
||||
v = pn.wait_for(|pn| pn != &curr_pn && pn.is_some()) => {
|
||||
v?;
|
||||
// If another PN during wait then go back to wait more
|
||||
continue;
|
||||
@@ -656,16 +657,17 @@ async fn stream_main(
|
||||
let mut curr_pn = None;
|
||||
let mut client_activator = stream_instance.activator_handle().await;
|
||||
client_activator.deactivate().await?;
|
||||
let thread_name = name.clone();
|
||||
set.spawn(async move {
|
||||
loop {
|
||||
curr_pn = pn
|
||||
.wait_for(|pn| pn != curr_pn && pn.is_some())
|
||||
.wait_for(|pn| pn != &curr_pn && pn.is_some())
|
||||
.await?
|
||||
.clone();
|
||||
log::info!("{}: Enabling Push Notification", thread_name);
|
||||
client_activator.activate().await?;
|
||||
tokio::select! {
|
||||
v = pn.wait_for(|pn| pn != curr_pn && pn.is_some()) => {
|
||||
v = pn.wait_for(|pn| pn != &curr_pn && pn.is_some()) => {
|
||||
v?;
|
||||
// If another PN during wait then go back to wait more
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user