pub fn induct_messages_to_self(
        &mut self,
        canister_available_memory: i64,
        subnet_available_memory: &mut i64,
        own_subnet_type: SubnetType,
    ) {
        // Bail out if the canister is not running.
        match self.status {
            CanisterStatus::Running { .. } => (),
            CanisterStatus::Stopped | CanisterStatus::Stopping { .. } => return,
        }

        if !ENFORCE_MESSAGE_MEMORY_USAGE || own_subnet_type == SubnetType::System {
            while self.queues.induct_message_to_self(self.canister_id).is_ok() {}
            return;
        }

        let mut available_memory = canister_available_memory.min(*subnet_available_memory);
        let mut memory_usage = self.queues.memory_usage() as i64;

        while let Some(msg) = self.queues.peek_output(&self.canister_id) {
            // Ensure that enough memory is available for inducting `msg`.
            if can_push(&*msg, available_memory).is_err() {
                // Bail out if not enough memory available for message.
                return;
            }

            // Attempt inducting `msg`. May fail if the input queue is full.
            if self
                .queues
                .induct_message_to_self(self.canister_id)
                .is_err()
            {
                return;
            }

            // Adjust both `available_memory` and `subnet_available_memory` by
            // `memory_usage_before - memory_usage_after`. Defer the accounting
            // to `CanisterQueues`, to avoid duplication or divergence.
            available_memory += memory_usage;
            *subnet_available_memory += memory_usage;
            memory_usage = self.queues.memory_usage() as i64;
            available_memory -= memory_usage;
            *subnet_available_memory -= memory_usage;
        }
    }
/// Inducts messages from the output queue to `self` into the input queue
/// from `self` while respecting queue capacity and the provided canister
/// and subnet available memory.
///
/// `subnet_available_memory` is updated to reflect the change in
/// `self.queues` memory usage.
Inducts messages from the output queue to `self` into the input queue
from `self` while respecting queue capacity and the provided canister
and subnet available memory.

`subnet_available_memory` is updated to reflect the change in
`self.queues` memory usage.
Inducts messages from the output queue to ` self ` into the input queue from ` self ` while respecting queue capacity and the provided canister and subnet available memory . ` subnet_available_memory ` is updated to reflect the change in ` self . queues ` memory usage .
pub fn induct_messages_to_self(
        &mut self,
        canister_available_memory: i64,
        subnet_available_memory: &mut i64,
        own_subnet_type: SubnetType,
    ) {
        // Bail out if the canister is not running.
        match self.status {
            CanisterStatus::Running { .. } => (),
            CanisterStatus::Stopped | CanisterStatus::Stopping { .. } => return,
        }
        if !ENFORCE_MESSAGE_MEMORY_USAGE || own_subnet_type == SubnetType::System {
            while self.queues.induct_message_to_self(self.canister_id).is_ok() {}
            return;
        }
        let mut available_memory = canister_available_memory.min(*subnet_available_memory);
        let mut memory_usage = self.queues.memory_usage() as i64;
        while let Some(msg) = self.queues.peek_output(&self.canister_id) {
            // Ensure that enough memory is available for inducting `msg`.
            if can_push(&*msg, available_memory).is_err() {
                // Bail out if not enough memory available for message.
                return;
            }
            // Attempt inducting `msg`. May fail if the input queue is full.
            if self
                .queues
                .induct_message_to_self(self.canister_id)
                .is_err()
            {
                return;
            }
            // Adjust both `available_memory` and `subnet_available_memory` by
            // `memory_usage_before - memory_usage_after`. Defer the accounting
            // to `CanisterQueues`, to avoid duplication or divergence.
            available_memory += memory_usage;
            *subnet_available_memory += memory_usage;
            memory_usage = self.queues.memory_usage() as i64;
            available_memory -= memory_usage;
            *subnet_available_memory -= memory_usage;
        }
    }
pub fn induct_messages_to_self ( & mut self , canister_available_memory : i64 , subnet_available_memory : & mut i64 , own_subnet_type : SubnetType , ) { // Bail out if the canister is not running. match self . status { CanisterStatus :: Running { .. } => ( ) , CanisterStatus :: Stopped | CanisterStatus :: Stopping { .. } => return , } if ! ENFORCE_MESSAGE_MEMORY_USAGE || own_subnet_type == SubnetType :: System { while self . queues . induct_message_to_self ( self . canister_id ) . is_ok ( ) { } return ; } let mut available_memory = canister_available_memory . min ( * subnet_available_memory ) ; let mut memory_usage = self . queues . memory_usage ( ) as i64 ; while let Some ( msg ) = self . queues . peek_output ( & self . canister_id ) { // Ensure that enough memory is available for inducting `msg`. if can_push ( & * msg , available_memory ) . is_err ( ) { // Bail out if not enough memory available for message. return ; } // Attempt inducting `msg`. May fail if the input queue is full. if self . queues . induct_message_to_self ( self . canister_id ) . is_err ( ) { return ; } // Adjust both `available_memory` and `subnet_available_memory` by // `memory_usage_before - memory_usage_after`. Defer the accounting // to `CanisterQueues`, to avoid duplication or divergence. available_memory += memory_usage ; * subnet_available_memory += memory_usage ; memory_usage = self . queues . memory_usage ( ) as i64 ; available_memory -= memory_usage ; * subnet_available_memory -= memory_usage ; } }
Inducts messages from the output queue to `self` into the input queue
from `self` while respecting queue capacity and the provided canister
and subnet available memory.
Inducts messages from the output queue to ` self ` into the input queue from ` self ` while respecting queue capacity and the provided canister and subnet available memory .
&mut self
canister_available_memory
i64
subnet_available_memory
&mut i64
own_subnet_type
SubnetType
&mut self
canister_available_memory
i64
subnet_available_memory
&mut i64
own_subnet_type
SubnetType