fn process(&self) -> NetworkStatus {
        let delivered = self.config.delivery.deliver_next(self);
        let mut idle_since = self.idle_since.borrow_mut();
        if let Some(new_time) = self.config.execution.execute_next(self) {
            self.time.set_time(new_time).ok();
        } else {
            let new_time = self.time.get_relative_time() + Duration::from_millis(100);
            self.time.set_time(new_time).ok();
        }
        let now = self.time.get_relative_time();

        let mut stopped = true;
        for instance in self.instances.iter() {
            // only stop when all instances satisfy StopPredicate
            if !(self.stop_predicate)(instance) {
                stopped = false;
                break;
            }
        }

        if stopped {
            NetworkStatus::Stopped
        } else if delivered {
            *idle_since = now;
            NetworkStatus::Continued
        } else if now > *idle_since + Duration::from_millis(MAX_IDLE_TIME) {
            // if MAX_IDLE_TIME has passed without any message delivered to any node,
            // we consider the network stalled.
            NetworkStatus::Stalled
        } else {
            NetworkStatus::Continued
        }
    }
/// Run a single step of all instances to finish processing their messages.
/// Return the updated NetworkStatus.
Run a single step of all instances to finish processing their messages.
Return the updated NetworkStatus.
Run a single step of all instances to finish processing their messages . Return the updated NetworkStatus .
fn process(&self) -> NetworkStatus {
        let delivered = self.config.delivery.deliver_next(self);
        let mut idle_since = self.idle_since.borrow_mut();
        if let Some(new_time) = self.config.execution.execute_next(self) {
            self.time.set_time(new_time).ok();
        } else {
            let new_time = self.time.get_relative_time() + Duration::from_millis(100);
            self.time.set_time(new_time).ok();
        }
        let now = self.time.get_relative_time();
        let mut stopped = true;
        for instance in self.instances.iter() {
            // only stop when all instances satisfy StopPredicate
            if !(self.stop_predicate)(instance) {
                stopped = false;
                break;
            }
        }
        if stopped {
            NetworkStatus::Stopped
        } else if delivered {
            *idle_since = now;
            NetworkStatus::Continued
        } else if now > *idle_since + Duration::from_millis(MAX_IDLE_TIME) {
            // if MAX_IDLE_TIME has passed without any message delivered to any node,
            // we consider the network stalled.
            NetworkStatus::Stalled
        } else {
            NetworkStatus::Continued
        }
    }
fn process ( & self ) -> NetworkStatus { let delivered = self . config . delivery . deliver_next ( self ) ; let mut idle_since = self . idle_since . borrow_mut ( ) ; if let Some ( new_time ) = self . config . execution . execute_next ( self ) { self . time . set_time ( new_time ) . ok ( ) ; } else { let new_time = self . time . get_relative_time ( ) + Duration :: from_millis ( 100 ) ; self . time . set_time ( new_time ) . ok ( ) ; } let now = self . time . get_relative_time ( ) ; let mut stopped = true ; for instance in self . instances . iter ( ) { // only stop when all instances satisfy StopPredicate if ! ( self . stop_predicate ) ( instance ) { stopped = false ; break ; } } if stopped { NetworkStatus :: Stopped } else if delivered { * idle_since = now ; NetworkStatus :: Continued } else if now > * idle_since + Duration :: from_millis ( MAX_IDLE_TIME ) { // if MAX_IDLE_TIME has passed without any message delivered to any node, // we consider the network stalled. NetworkStatus :: Stalled } else { NetworkStatus :: Continued } }
Run a single step of all instances to finish processing their messages.
Run a single step of all instances to finish processing their messages .
&self
&self