/// Consume the discovery queue and initiate queries when applicable.
///
/// This also sanitizes the queue removing out-dated queries.
Consume the discovery queue and initiate queries when applicable.
This also sanitizes the queue removing out-dated queries.
Consume the discovery queue and initiate queries when applicable . This also sanitizes the queue removing out - dated queries .
fn process_queue(&mut self) {
        // Sanitize the queue, removing any out-dated subnet queries
        self.queued_queries.retain(|query| !query.expired());
        // Check that we are within our query concurrency limit
        while !self.at_capacity() && !self.queued_queries.is_empty() {
            // consume and process the query queue
            match self.queued_queries.pop_front() {
                Some(QueryType::FindPeers) => {
                    // Only permit one FindPeers query at a time
                    if self.find_peer_active {
                        self.queued_queries.push_back(QueryType::FindPeers);
                        continue;
                    }
                    // This is a regular request to find additional peers
                    debug!(self.log, "Searching for new peers");
                    self.find_peer_active = true;
                    self.start_query(QueryType::FindPeers, FIND_NODE_QUERY_CLOSEST_PEERS);
                }
                Some(QueryType::Subnet { .. }) => {}
                None => {} // Queue is empty
            }
        }
    }
fn process_queue ( & mut self ) { // Sanitize the queue, removing any out-dated subnet queries self . queued_queries . retain ( | query | ! query . expired ( ) ) ; // Check that we are within our query concurrency limit while ! self . at_capacity ( ) && ! self . queued_queries . is_empty ( ) { // consume and process the query queue match self . queued_queries . pop_front ( ) { Some ( QueryType :: FindPeers ) => { // Only permit one FindPeers query at a time if self . find_peer_active { self . queued_queries . push_back ( QueryType :: FindPeers ) ; continue ; } // This is a regular request to find additional peers debug ! ( self log " " ) ; self . find_peer_active = true ; self . start_query ( QueryType :: FindPeers , FIND_NODE_QUERY_CLOSEST_PEERS ) ; } Some ( QueryType :: Subnet { .. } ) => { } None => { } // Queue is empty } } }
Consume the discovery queue and initiate queries when applicable.
Consume the discovery queue and initiate queries when applicable .
&mut self