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 mut command_stream = connection.take_command_stream();

    while let Some(result) = command_stream.next().await {
        match result {
            Ok(command) => {
                let handle_command_fut = { peer.read().command_handler.handle_command(command) };

                if let Err(e) = handle_command_fut.await {
                    fx_log_info!("Command returned error from command handler {:?}", e);
                }
            }
            Err(e) => {
                fx_log_info!("Command stream returned error {:?}", e);
                break;
            }
        }
    }
    // command stream closed or 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 started only when we have 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 started only when we have 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 started only when we have 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 mut command_stream = connection.take_command_stream();
    while let Some(result) = command_stream.next().await {
        match result {
            Ok(command) => {
                let handle_command_fut = { peer.read().command_handler.handle_command(command) };
                if let Err(e) = handle_command_fut.await {
                    fx_log_info!("Command returned error from command handler {:?}", e);
                }
            }
            Err(e) => {
                fx_log_info!("Command stream returned error {:?}", e);
                break;
            }
        }
    }
    // command stream closed or 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 mut command_stream = connection . take_command_stream ( ) ; while let Some ( result ) = command_stream . next ( ) . await { match result { Ok ( command ) => { let handle_command_fut = { peer . read ( ) . command_handler . handle_command ( command ) } ; if let Err ( e ) = handle_command_fut . await { fx_log_info ! ( " " e ) ; } } Err ( e ) => { fx_log_info ! ( " " e ) ; break ; } } } // command stream closed or 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>>