/// Iterates over all canisters on the subnet, checking if a source canister
/// has output messages for a destination canister on the same subnet and
/// moving them from the source to the destination canister if the
/// destination canister has room for them.
///
/// This method only handles messages sent to self and to other canisters.
/// Messages sent to the subnet are not handled i.e. they take the slow path
/// through message routing.
Iterates over all canisters on the subnet, checking if a source canister
has output messages for a destination canister on the same subnet and
moving them from the source to the destination canister if the
destination canister has room for them.

This method only handles messages sent to self and to other canisters.
Messages sent to the subnet are not handled i.e. they take the slow path
through message routing.
Iterates over all canisters on the subnet checking if a source canister has output messages for a destination canister on the same subnet and moving them from the source to the destination canister if the destination canister has room for them . This method only handles messages sent to self and to other canisters . Messages sent to the subnet are not handled i . e . they take the slow path through message routing .
pub fn induct_messages_on_same_subnet(&self, state: &mut ReplicatedState) {
        // Compute subnet available memory *before* taking out the canisters.
        let mut subnet_available_memory = self.exec_env.subnet_available_memory(state);
        let max_canister_memory_size = self.exec_env.max_canister_memory_size();
        let mut canisters = state.take_canister_states();
        // Get a list of canisters in the map before we iterate over the map.
        // This is because we cannot hold an immutable reference to the map
        // while trying to simultaneously mutate it.
        let canister_ids: Vec<CanisterId> = canisters.keys().copied().collect();
        for source_canister_id in canister_ids {
            // Remove the source canister from the map so that we can
            // `get_mut()` on the map further below for the destination canister.
            // Borrow rules do not allow us to hold multiple mutable references.
            let mut source_canister = match canisters.remove(&source_canister_id) {
                None => fatal!(
                    self.log,
                    "Should be guaranteed that the canister exists in the map."
                ),
                Some(canister) => canister,
            };
            source_canister.induct_messages_to_self(
                max_canister_memory_size,
                &mut subnet_available_memory,
                state.metadata.own_subnet_type,
            );
            source_canister
                .system_state
                .output_queues_for_each(|canister_id, msg| match canisters.get_mut(canister_id) {
                    Some(dest_canister) => dest_canister
                        .push_input(
                            QUEUE_INDEX_NONE,
                            (*msg).clone(),
                            max_canister_memory_size,
                            &mut subnet_available_memory,
                            state.metadata.own_subnet_type,
                            InputQueueType::LocalSubnet,
                        )
                        .map_err(|_| ()),
                    None => Err(()),
                });
            canisters.insert(source_canister_id, source_canister);
        }
        state.put_canister_states(canisters);
    }
pub fn induct_messages_on_same_subnet ( & self , state : & mut ReplicatedState ) { // Compute subnet available memory *before* taking out the canisters. let mut subnet_available_memory = self . exec_env . subnet_available_memory ( state ) ; let max_canister_memory_size = self . exec_env . max_canister_memory_size ( ) ; let mut canisters = state . take_canister_states ( ) ; // Get a list of canisters in the map before we iterate over the map. // This is because we cannot hold an immutable reference to the map // while trying to simultaneously mutate it. let canister_ids : Vec < CanisterId > = canisters . keys ( ) . copied ( ) . collect ( ) ; for source_canister_id in canister_ids { // Remove the source canister from the map so that we can // `get_mut()` on the map further below for the destination canister. // Borrow rules do not allow us to hold multiple mutable references. let mut source_canister = match canisters . remove ( & source_canister_id ) { None => fatal ! ( self log " " ) , Some ( canister ) => canister , } ; source_canister . induct_messages_to_self ( max_canister_memory_size , & mut subnet_available_memory , state . metadata . own_subnet_type , ) ; source_canister . system_state . output_queues_for_each ( | canister_id , msg | match canisters . get_mut ( canister_id ) { Some ( dest_canister ) => dest_canister . push_input ( QUEUE_INDEX_NONE , ( * msg ) . clone ( ) , max_canister_memory_size , & mut subnet_available_memory , state . metadata . own_subnet_type , InputQueueType :: LocalSubnet , ) . map_err ( | _ | ( ) ) , None => Err ( ( ) ) , } ) ; canisters . insert ( source_canister_id , source_canister ) ; } state . put_canister_states ( canisters ) ; }
Iterates over all canisters on the subnet, checking if a source canister
has output messages for a destination canister on the same subnet and
moving them from the source to the destination canister if the
destination canister has room for them.
Iterates over all canisters on the subnet checking if a source canister has output messages for a destination canister on the same subnet and moving them from the source to the destination canister if the destination canister has room for them .
&self
state
&mut ReplicatedState