pub async fn run(mut self) {
        loop {
            futures::select! {
                event = self.swarm.next() => match event.expect("Swarm stream to be infinite.") {
                    SwarmEvent::Behaviour(PyrsiaNetworkEvent::Kademlia(kademlia_event)) => self.handle_kademlia_event(kademlia_event).await,
                    SwarmEvent::Behaviour(PyrsiaNetworkEvent::RequestResponse(request_response_event)) => self.handle_request_response_event(request_response_event).await,
                    SwarmEvent::Behaviour(PyrsiaNetworkEvent::IdleMetricRequestResponse(request_response_event)) => self.handle_idle_metric_request_response_event(request_response_event).await,
                    swarm_event => self.handle_swarm_event(swarm_event).await,
                },
                command = self.command_receiver.next() => match command {
                    Some(c) => {
                        self.handle_command(c).await;
                    },
                    // Command channel closed, thus shutting down the network event loop.
                    None => { warn!("Got empty command"); return },
                },
            }
        }
    }
/// Creates the actual event loop to begin listening for
/// incoming events on the swarm and command channels.
Creates the actual event loop to begin listening for
incoming events on the swarm and command channels.
Creates the actual event loop to begin listening for incoming events on the swarm and command channels .
pub async fn run(mut self) {
        loop {
            futures::select! {
                event = self.swarm.next() => match event.expect("Swarm stream to be infinite.") {
                    SwarmEvent::Behaviour(PyrsiaNetworkEvent::Kademlia(kademlia_event)) => self.handle_kademlia_event(kademlia_event).await,
                    SwarmEvent::Behaviour(PyrsiaNetworkEvent::RequestResponse(request_response_event)) => self.handle_request_response_event(request_response_event).await,
                    SwarmEvent::Behaviour(PyrsiaNetworkEvent::IdleMetricRequestResponse(request_response_event)) => self.handle_idle_metric_request_response_event(request_response_event).await,
                    swarm_event => self.handle_swarm_event(swarm_event).await,
                },
                command = self.command_receiver.next() => match command {
                    Some(c) => {
                        self.handle_command(c).await;
                    },
                    // Command channel closed, thus shutting down the network event loop.
                    None => { warn!("Got empty command"); return },
                },
            }
        }
    }
pub async fn run ( mut self ) { loop { futures :: select ! { event self swarm next ( ) match event expect ( " " ) { SwarmEvent Behaviour ( PyrsiaNetworkEvent Kademlia ( kademlia_event ) ) self handle_kademlia_event ( kademlia_event ) await SwarmEvent Behaviour ( PyrsiaNetworkEvent RequestResponse ( request_response_event ) ) self handle_request_response_event ( request_response_event ) await SwarmEvent Behaviour ( PyrsiaNetworkEvent IdleMetricRequestResponse ( request_response_event ) ) self handle_idle_metric_request_response_event ( request_response_event ) await swarm_event self handle_swarm_event ( swarm_event ) await } command self command_receiver next ( ) match command { Some ( c ) { self handle_command ( c ) await } // Command channel closed, thus shutting down the network event loop. None { warn ( " " ) return } } } } }
Creates the actual event loop to begin listening for
incoming events on the swarm and command channels.
Creates the actual event loop to begin listening for incoming events on the swarm and command channels .
mut self
mut self