async fn process_control_stream(peer: Arc<RwLock<RemotePeer>>) {
    let connection = {
        let peer_guard = peer.read();

        match peer_guard.control_channel.connection() {
            Some(connection) => connection.clone(),
            None => return,
        }
    };

    let command_stream = connection.take_command_stream();

    // Limit to 16 since that is the max number of transactions we can process at any one time per
    // AVCTP
    match command_stream
        .map(Ok)
        .try_for_each_concurrent(16, |command| async {
            let fut = peer.read().control_command_handler.handle_command(command.unwrap());
            let result: Result<(), PeerError> = fut.await;
            result
        })
        .await
    {
        Ok(_) => fx_log_info!("Peer command stream closed"),
        Err(e) => fx_log_err!("Peer command returned error {:?}", e),
    }

    // Command stream closed/errored. Disconnect the peer.
    {
        peer.write().reset_connection(false);
    }
}
/// Processes incoming commands from the control stream and dispatches them to the control command
/// handler. This is started only when we have a connection and when we have either a target or
/// controller SDP profile record for the current peer.
Processes incoming commands from the control stream and dispatches them to the control command
handler. This is started only when we have a connection and when we have either a target or
controller SDP profile record for the current peer.
Processes incoming commands from the control stream and dispatches them to the control command handler . This is started only when we have a connection and when we have either a target or controller SDP profile record for the current peer .
async fn process_control_stream(peer: Arc<RwLock<RemotePeer>>) {
    let connection = {
        let peer_guard = peer.read();
        match peer_guard.control_channel.connection() {
            Some(connection) => connection.clone(),
            None => return,
        }
    };
    let command_stream = connection.take_command_stream();
    // Limit to 16 since that is the max number of transactions we can process at any one time per
    // AVCTP
    match command_stream
        .map(Ok)
        .try_for_each_concurrent(16, |command| async {
            let fut = peer.read().control_command_handler.handle_command(command.unwrap());
            let result: Result<(), PeerError> = fut.await;
            result
        })
        .await
    {
        Ok(_) => fx_log_info!("Peer command stream closed"),
        Err(e) => fx_log_err!("Peer command returned error {:?}", e),
    }
    // Command stream closed/errored. Disconnect the peer.
    {
        peer.write().reset_connection(false);
    }
}
async fn process_control_stream ( peer : Arc < RwLock < RemotePeer > > ) { let connection = { let peer_guard = peer . read ( ) ; match peer_guard . control_channel . connection ( ) { Some ( connection ) => connection . clone ( ) , None => return , } } ; let command_stream = connection . take_command_stream ( ) ; // Limit to 16 since that is the max number of transactions we can process at any one time per // AVCTP match command_stream . map ( Ok ) . try_for_each_concurrent ( 16 , | command | async { let fut = peer . read ( ) . control_command_handler . handle_command ( command . unwrap ( ) ) ; let result : Result < ( ) , PeerError > = fut . await ; result } ) . await { Ok ( _ ) => fx_log_info ! ( " " ) , Err ( e ) => fx_log_err ! ( " " e ) , } // Command stream closed/errored. Disconnect the peer. { peer . write ( ) . reset_connection ( false ) ; } }
Processes incoming commands from the control stream and dispatches them to the control command
handler.
Processes incoming commands from the control stream and dispatches them to the control command handler .
peer
Arc<RwLock<RemotePeer>>
peer
Arc<RwLock<RemotePeer>>