fn shut_down_tasks_and_channels(&mut self) {
        // Drop services and cancel their background tasks.
        self.preselected_p2c_peer = None;
        self.ready_services = HashMap::new();

        for (_peer_key, handle) in self.cancel_handles.drain() {
            let _ = handle.send(CancelClientWork);
        }
        self.unready_services = FuturesUnordered::new();

        // Close the MorePeers channel for all senders,
        // so we don't add more peers to a shut down peer set.
        self.demand_signal.close_channel();

        // Shut down background tasks.
        self.handle_rx.close();
        self.receive_tasks_if_needed();
        for guard in self.guards.iter() {
            guard.abort();
        }

        // TODO: implement graceful shutdown for InventoryRegistry (#1678)
    }
/// Shut down:
/// - services by dropping the service lists
/// - background tasks via their join handles or cancel handles
/// - channels by closing the channel
Shut down:
services by dropping the service lists
background tasks via their join handles or cancel handles
channels by closing the channel
Shut down : services by dropping the service lists background tasks via their join handles or cancel handles channels by closing the channel
fn shut_down_tasks_and_channels(&mut self) {
        // Drop services and cancel their background tasks.
        self.preselected_p2c_peer = None;
        self.ready_services = HashMap::new();
        for (_peer_key, handle) in self.cancel_handles.drain() {
            let _ = handle.send(CancelClientWork);
        }
        self.unready_services = FuturesUnordered::new();
        // Close the MorePeers channel for all senders,
        // so we don't add more peers to a shut down peer set.
        self.demand_signal.close_channel();
        // Shut down background tasks.
        self.handle_rx.close();
        self.receive_tasks_if_needed();
        for guard in self.guards.iter() {
            guard.abort();
        }
        // TODO: implement graceful shutdown for InventoryRegistry (#1678)
    }
fn shut_down_tasks_and_channels ( & mut self ) { // Drop services and cancel their background tasks. self . preselected_p2c_peer = None ; self . ready_services = HashMap :: new ( ) ; for ( _peer_key , handle ) in self . cancel_handles . drain ( ) { let _ = handle . send ( CancelClientWork ) ; } self . unready_services = FuturesUnordered :: new ( ) ; // Close the MorePeers channel for all senders, // so we don't add more peers to a shut down peer set. self . demand_signal . close_channel ( ) ; // Shut down background tasks. self . handle_rx . close ( ) ; self . receive_tasks_if_needed ( ) ; for guard in self . guards . iter ( ) { guard . abort ( ) ; } // TODO: implement graceful shutdown for InventoryRegistry (#1678) }
Shut down:
 services by dropping the service lists
 background tasks via their join handles or cancel handles
 channels by closing the channel
Shut down : services by dropping the service lists background tasks via their join handles or cancel handles channels by closing the channel
&mut self