pub(crate) fn pop_input(&mut self) -> Option<CanisterInputMessage> {
        // Try all 3 input: Ingress, Local, and Remote subnets
        for _ in 0..3 {
            let cur_input_queue = self.next_input_queue;
            // Switch to the next input queue
            self.next_input_queue = match self.next_input_queue {
                NextInputQueue::LocalSubnet => NextInputQueue::Ingress,
                NextInputQueue::Ingress => NextInputQueue::RemoteSubnet,
                NextInputQueue::RemoteSubnet => NextInputQueue::LocalSubnet,
            };

            let next_input = match cur_input_queue {
                NextInputQueue::Ingress => self.pop_ingress().map(CanisterInputMessage::Ingress),

                NextInputQueue::RemoteSubnet => self
                    .pop_canister_input(InputQueueType::RemoteSubnet)
                    .map(|msg| match msg {
                        RequestOrResponse::Request(msg) => CanisterInputMessage::Request(msg),
                        RequestOrResponse::Response(msg) => CanisterInputMessage::Response(msg),
                    }),

                NextInputQueue::LocalSubnet => self
                    .pop_canister_input(InputQueueType::LocalSubnet)
                    .map(|msg| match msg {
                        RequestOrResponse::Request(msg) => CanisterInputMessage::Request(msg),
                        RequestOrResponse::Response(msg) => CanisterInputMessage::Response(msg),
                    }),
            };

            if next_input.is_some() {
                return next_input;
            }
        }

        None
    }
/// Extracts the next ingress, priority, or normal message (round-robin).
///
/// We define three buckets of queues: messages from canisters on the same
/// subnet (local subnet), ingress, and messages from canisters on other
/// subnets (remote subnet).
///
/// Each time this function is called, we round robin between these three
/// buckets. We also round robin between the queues in the local subnet and
/// remote subnet buckets when we pop messages from those buckets.
Extracts the next ingress, priority, or normal message (round-robin).
We define three buckets of queues: messages from canisters on the same
subnet (local subnet), ingress, and messages from canisters on other
subnets (remote subnet).

Each time this function is called, we round robin between these three
buckets. We also round robin between the queues in the local subnet and
remote subnet buckets when we pop messages from those buckets.
Extracts the next ingress priority or normal message ( round - robin ) . We define three buckets of queues : messages from canisters on the same subnet ( local subnet ) ingress and messages from canisters on other subnets ( remote subnet ) . Each time this function is called we round robin between these three buckets . We also round robin between the queues in the local subnet and remote subnet buckets when we pop messages from those buckets .
pub(crate) fn pop_input(&mut self) -> Option<CanisterInputMessage> {
        // Try all 3 input: Ingress, Local, and Remote subnets
        for _ in 0..3 {
            let cur_input_queue = self.next_input_queue;
            // Switch to the next input queue
            self.next_input_queue = match self.next_input_queue {
                NextInputQueue::LocalSubnet => NextInputQueue::Ingress,
                NextInputQueue::Ingress => NextInputQueue::RemoteSubnet,
                NextInputQueue::RemoteSubnet => NextInputQueue::LocalSubnet,
            };
            let next_input = match cur_input_queue {
                NextInputQueue::Ingress => self.pop_ingress().map(CanisterInputMessage::Ingress),
                NextInputQueue::RemoteSubnet => self
                    .pop_canister_input(InputQueueType::RemoteSubnet)
                    .map(|msg| match msg {
                        RequestOrResponse::Request(msg) => CanisterInputMessage::Request(msg),
                        RequestOrResponse::Response(msg) => CanisterInputMessage::Response(msg),
                    }),
                NextInputQueue::LocalSubnet => self
                    .pop_canister_input(InputQueueType::LocalSubnet)
                    .map(|msg| match msg {
                        RequestOrResponse::Request(msg) => CanisterInputMessage::Request(msg),
                        RequestOrResponse::Response(msg) => CanisterInputMessage::Response(msg),
                    }),
            };
            if next_input.is_some() {
                return next_input;
            }
        }
        None
    }
pub ( crate ) fn pop_input ( & mut self ) -> Option < CanisterInputMessage > { // Try all 3 input: Ingress, Local, and Remote subnets for _ in 0 .. 3 { let cur_input_queue = self . next_input_queue ; // Switch to the next input queue self . next_input_queue = match self . next_input_queue { NextInputQueue :: LocalSubnet => NextInputQueue :: Ingress , NextInputQueue :: Ingress => NextInputQueue :: RemoteSubnet , NextInputQueue :: RemoteSubnet => NextInputQueue :: LocalSubnet , } ; let next_input = match cur_input_queue { NextInputQueue :: Ingress => self . pop_ingress ( ) . map ( CanisterInputMessage :: Ingress ) , NextInputQueue :: RemoteSubnet => self . pop_canister_input ( InputQueueType :: RemoteSubnet ) . map ( | msg | match msg { RequestOrResponse :: Request ( msg ) => CanisterInputMessage :: Request ( msg ) , RequestOrResponse :: Response ( msg ) => CanisterInputMessage :: Response ( msg ) , } ) , NextInputQueue :: LocalSubnet => self . pop_canister_input ( InputQueueType :: LocalSubnet ) . map ( | msg | match msg { RequestOrResponse :: Request ( msg ) => CanisterInputMessage :: Request ( msg ) , RequestOrResponse :: Response ( msg ) => CanisterInputMessage :: Response ( msg ) , } ) , } ; if next_input . is_some ( ) { return next_input ; } } None }
Extracts the next ingress, priority, or normal message (round-robin).
Extracts the next ingress priority or normal message ( round - robin ) .
&mut self
&mut self