// Rejects pending stop requests with an error indicating the request has been
// cancelled.
Rejects pending stop requests with an error indicating the request has been
cancelled.
Rejects pending stop requests with an error indicating the request has been cancelled .
fn reject_stop_requests(
        &self,
        canister_id: CanisterId,
        stop_contexts: Vec<StopCanisterContext>,
        state: &mut ReplicatedState,
    ) {
        for stop_context in stop_contexts {
            match stop_context {
                StopCanisterContext::Ingress { sender, message_id } => {
                    let time = state.time();
                    // Rejecting a stop_canister request from a user.
                    self.ingress_history_writer.set_status(
                        state,
                        message_id,
                        IngressStatus::Failed {
                            receiver: IC_00.get(),
                            user_id: sender,
                            error: UserError::new(
                                ErrorCode::CanisterStoppingCancelled,
                                format!("Canister {}'s stop request was cancelled.", canister_id),
                            ),
                            time,
                        },
                    );
                }
                StopCanisterContext::Canister {
                    sender,
                    reply_callback,
                    cycles,
                } => {
                    // Rejecting a 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::Reject(RejectContext {
                            code: RejectCode::CanisterReject,
                            message: format!("Canister {}'s stop request cancelled", canister_id),
                        }),
                    };
                    state.subnet_queues.push_output_response(response);
                }
            }
        }
    }
fn reject_stop_requests ( & self , canister_id : CanisterId , stop_contexts : Vec < StopCanisterContext > , state : & mut ReplicatedState , ) { for stop_context in stop_contexts { match stop_context { StopCanisterContext :: Ingress { sender , message_id } => { let time = state . time ( ) ; // Rejecting a stop_canister request from a user. self . ingress_history_writer . set_status ( state , message_id , IngressStatus :: Failed { receiver : IC_00 . get ( ) , user_id : sender , error : UserError :: new ( ErrorCode :: CanisterStoppingCancelled , format ! ( " " canister_id ) , ) , time , } , ) ; } StopCanisterContext :: Canister { sender , reply_callback , cycles , } => { // Rejecting a 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 :: Reject ( RejectContext { code : RejectCode :: CanisterReject , message : format ! ( " " canister_id ) , } ) , } ; state . subnet_queues . push_output_response ( response ) ; } } } }
Rejects pending stop requests with an error indicating the request has been
cancelled.
Rejects pending stop requests with an error indicating the request has been cancelled .
&self
canister_id
CanisterId
stop_contexts
Vec<StopCanisterContext>
state
&mut ReplicatedState