pub fn expire_state(&self) {
        self.update_connection_state(|current_state| {
            let expire_duration = match current_state {
                ConnectionState::Mdns(_) => MDNS_MAX_AGE,
                ConnectionState::Fastboot(_) => FASTBOOT_MAX_AGE,
                ConnectionState::Zedboot(_) => ZEDBOOT_MAX_AGE,
                _ => Duration::default(),
            };

            let new_state = match &current_state {
                ConnectionState::Mdns(ref last_seen)
                | ConnectionState::Fastboot(ref last_seen)
                | ConnectionState::Zedboot(ref last_seen) => {
                    if last_seen.elapsed() > expire_duration {
                        Some(ConnectionState::Disconnected)
                    } else {
                        None
                    }
                }
                _ => None,
            };

            if let Some(ref new_state) = new_state {
                log::debug!(
                    "Target {:?} state {:?} => {:?} due to expired state after {:?}.",
                    self,
                    &current_state,
                    new_state,
                    expire_duration
                );
            }

            new_state.unwrap_or(current_state)
        });
    }
/// Check the current target state, and if it is a state that expires (such
/// as mdns) perform the appropriate state transition. The daemon target
/// collection expiry loop calls this function regularly.
Check the current target state, and if it is a state that expires (such
as mdns) perform the appropriate state transition. The daemon target
collection expiry loop calls this function regularly.
Check the current target state and if it is a state that expires ( such as mdns ) perform the appropriate state transition . The daemon target collection expiry loop calls this function regularly .
pub fn expire_state(&self) {
        self.update_connection_state(|current_state| {
            let expire_duration = match current_state {
                ConnectionState::Mdns(_) => MDNS_MAX_AGE,
                ConnectionState::Fastboot(_) => FASTBOOT_MAX_AGE,
                ConnectionState::Zedboot(_) => ZEDBOOT_MAX_AGE,
                _ => Duration::default(),
            };
            let new_state = match &current_state {
                ConnectionState::Mdns(ref last_seen)
                | ConnectionState::Fastboot(ref last_seen)
                | ConnectionState::Zedboot(ref last_seen) => {
                    if last_seen.elapsed() > expire_duration {
                        Some(ConnectionState::Disconnected)
                    } else {
                        None
                    }
                }
                _ => None,
            };
            if let Some(ref new_state) = new_state {
                log::debug!(
                    "Target {:?} state {:?} => {:?} due to expired state after {:?}.",
                    self,
                    &current_state,
                    new_state,
                    expire_duration
                );
            }
            new_state.unwrap_or(current_state)
        });
    }
pub fn expire_state ( & self ) { self . update_connection_state ( | current_state | { let expire_duration = match current_state { ConnectionState :: Mdns ( _ ) => MDNS_MAX_AGE , ConnectionState :: Fastboot ( _ ) => FASTBOOT_MAX_AGE , ConnectionState :: Zedboot ( _ ) => ZEDBOOT_MAX_AGE , _ => Duration :: default ( ) , } ; let new_state = match & current_state { ConnectionState :: Mdns ( ref last_seen ) | ConnectionState :: Fastboot ( ref last_seen ) | ConnectionState :: Zedboot ( ref last_seen ) => { if last_seen . elapsed ( ) > expire_duration { Some ( ConnectionState :: Disconnected ) } else { None } } _ => None , } ; if let Some ( ref new_state ) = new_state { log :: debug ! ( " " self current_state new_state expire_duration ) ; } new_state . unwrap_or ( current_state ) } ) ; }
Check the current target state, and if it is a state that expires (such
as mdns) perform the appropriate state transition.
Check the current target state and if it is a state that expires ( such as mdns ) perform the appropriate state transition .
&self
&self