/// The function processes management commands.
The function processes management commands.
The function processes management commands .
fn process_management_commands(
        receive_map: &mut ReceiveMap<T>,
        management_command_receiver: &mut ManagementCommandReceiver<T>,
    ) -> P2PResult<()> {
        loop {
            match management_command_receiver.try_recv() {
                Ok(cmd) => match cmd {
                    ManagementCommands::AddPeer(node_id, receiver) => {
                        receive_map.push((node_id, receiver));
                    }
                    ManagementCommands::Stop => return P2PErrorCode::ChannelShutDown.into(),
                },
                Err(crossbeam_channel::TryRecvError::Empty) => return Ok(()),
                Err(crossbeam_channel::TryRecvError::Disconnected) => {
                    return P2PErrorCode::ChannelShutDown.into()
                }
            }
        }
    }
fn process_management_commands ( receive_map : & mut ReceiveMap < T > , management_command_receiver : & mut ManagementCommandReceiver < T > , ) -> P2PResult < ( ) > { loop { match management_command_receiver . try_recv ( ) { Ok ( cmd ) => match cmd { ManagementCommands :: AddPeer ( node_id , receiver ) => { receive_map . push ( ( node_id , receiver ) ) ; } ManagementCommands :: Stop => return P2PErrorCode :: ChannelShutDown . into ( ) , } , Err ( crossbeam_channel :: TryRecvError :: Empty ) => return Ok ( ( ) ) , Err ( crossbeam_channel :: TryRecvError :: Disconnected ) => { return P2PErrorCode :: ChannelShutDown . into ( ) } } } }
The function processes management commands.
The function processes management commands .
receive_map
&mut ReceiveMap<T>
management_command_receiver
&mut ManagementCommandReceiver<T>