fn process_stopping_canisters(&self, mut state: ReplicatedState) -> ReplicatedState {
        let mut canister_states = state.take_canister_states();
        let time = state.time();

        for canister in canister_states.values_mut() {
            if !(canister.status() == CanisterStatusType::Stopping
                && canister.system_state.ready_to_stop())
            {
                // Canister is either not stopping or isn't ready to be stopped yet. Nothing to
                // do.
                continue;
            }

            // Transition the canister to "stopped".
            let stopping_status =
                mem::replace(&mut canister.system_state.status, CanisterStatus::Stopped);

            if let CanisterStatus::Stopping { stop_contexts, .. } = stopping_status {
                // Respond to the stop messages.
                for stop_context in stop_contexts {
                    match stop_context {
                        StopCanisterContext::Ingress { sender, message_id } => {
                            // Responding to stop_canister request from a user.
                            self.ingress_history_writer.set_status(
                                &mut state,
                                message_id,
                                IngressStatus::Completed {
                                    receiver: IC_00.get(),
                                    user_id: sender,
                                    result: WasmResult::Reply(EmptyBlob::encode()),
                                    time,
                                },
                            )
                        }
                        StopCanisterContext::Canister {
                            sender,
                            reply_callback,
                            cycles,
                        } => {
                            // Responding to stop_canister request from a canister.
                            let subnet_id_as_canister_id = CanisterId::from(self.own_subnet_id);
                            let response = Response {
                                originator: sender,
                                respondent: subnet_id_as_canister_id,
                                originator_reply_callback: reply_callback,
                                refund: cycles,
                                response_payload: Payload::Data(EmptyBlob::encode()),
                            };
                            state.push_subnet_output_response(response);
                        }
                    }
                }
            }
        }
        state.put_canister_states(canister_states);
        state
    }
// Checks for stopping canisters and, if any of them are ready to stop,
// transitions them to be fully stopped. Responses to the pending stop
// message(s) are written to ingress history.
Checks for stopping canisters and, if any of them are ready to stop,
transitions them to be fully stopped. Responses to the pending stop
message(s) are written to ingress history.
Checks for stopping canisters and if any of them are ready to stop transitions them to be fully stopped . Responses to the pending stop message ( s ) are written to ingress history .
fn process_stopping_canisters(&self, mut state: ReplicatedState) -> ReplicatedState {
        let mut canister_states = state.take_canister_states();
        let time = state.time();
        for canister in canister_states.values_mut() {
            if !(canister.status() == CanisterStatusType::Stopping
                && canister.system_state.ready_to_stop())
            {
                // Canister is either not stopping or isn't ready to be stopped yet. Nothing to
                // do.
                continue;
            }
            // Transition the canister to "stopped".
            let stopping_status =
                mem::replace(&mut canister.system_state.status, CanisterStatus::Stopped);
            if let CanisterStatus::Stopping { stop_contexts, .. } = stopping_status {
                // Respond to the stop messages.
                for stop_context in stop_contexts {
                    match stop_context {
                        StopCanisterContext::Ingress { sender, message_id } => {
                            // Responding to stop_canister request from a user.
                            self.ingress_history_writer.set_status(
                                &mut state,
                                message_id,
                                IngressStatus::Completed {
                                    receiver: IC_00.get(),
                                    user_id: sender,
                                    result: WasmResult::Reply(EmptyBlob::encode()),
                                    time,
                                },
                            )
                        }
                        StopCanisterContext::Canister {
                            sender,
                            reply_callback,
                            cycles,
                        } => {
                            // Responding to stop_canister request from a canister.
                            let subnet_id_as_canister_id = CanisterId::from(self.own_subnet_id);
                            let response = Response {
                                originator: sender,
                                respondent: subnet_id_as_canister_id,
                                originator_reply_callback: reply_callback,
                                refund: cycles,
                                response_payload: Payload::Data(EmptyBlob::encode()),
                            };
                            state.push_subnet_output_response(response);
                        }
                    }
                }
            }
        }
        state.put_canister_states(canister_states);
        state
    }
fn process_stopping_canisters ( & self , mut state : ReplicatedState ) -> ReplicatedState { let mut canister_states = state . take_canister_states ( ) ; let time = state . time ( ) ; for canister in canister_states . values_mut ( ) { if ! ( canister . status ( ) == CanisterStatusType :: Stopping && canister . system_state . ready_to_stop ( ) ) { // Canister is either not stopping or isn't ready to be stopped yet. Nothing to // do. continue ; } // Transition the canister to "stopped". let stopping_status = mem :: replace ( & mut canister . system_state . status , CanisterStatus :: Stopped ) ; if let CanisterStatus :: Stopping { stop_contexts , .. } = stopping_status { // Respond to the stop messages. for stop_context in stop_contexts { match stop_context { StopCanisterContext :: Ingress { sender , message_id } => { // Responding to stop_canister request from a user. self . ingress_history_writer . set_status ( & mut state , message_id , IngressStatus :: Completed { receiver : IC_00 . get ( ) , user_id : sender , result : WasmResult :: Reply ( EmptyBlob :: encode ( ) ) , time , } , ) } StopCanisterContext :: Canister { sender , reply_callback , cycles , } => { // Responding to stop_canister request from a canister. let subnet_id_as_canister_id = CanisterId :: from ( self . own_subnet_id ) ; let response = Response { originator : sender , respondent : subnet_id_as_canister_id , originator_reply_callback : reply_callback , refund : cycles , response_payload : Payload :: Data ( EmptyBlob :: encode ( ) ) , } ; state . push_subnet_output_response ( response ) ; } } } } } state . put_canister_states ( canister_states ) ; state }
Checks for stopping canisters and, if any of them are ready to stop,
transitions them to be fully stopped.
Checks for stopping canisters and if any of them are ready to stop transitions them to be fully stopped .
&self
state
ReplicatedState
&self
state
ReplicatedState