async fn process_outgoing_requests(
    tenant: String,
    id: usize,
    mut channel: SessionChannel,
    mut stdin_rx: mpsc::Receiver<Vec<u8>>,
    mut kill_rx: mpsc::Receiver<()>,
) -> Result<(), RemoteProcessError> {
    let result = loop {
        tokio::select! {
            data = stdin_rx.recv() => {
                match data {
                    Some(data) => channel.fire(
                        Request::new(
                            tenant.as_str(),
                            vec![RequestData::ProcStdin { id, data }]
                        )
                    ).await?,
                    None => break Err(RemoteProcessError::ChannelDead),
                }
            }
            msg = kill_rx.recv() => {
                if msg.is_some() {
                    channel.fire(Request::new(
                        tenant.as_str(),
                        vec![RequestData::ProcKill { id }],
                    )).await?;
                    break Ok(());
                } else {
                    break Err(RemoteProcessError::ChannelDead);
                }
            }
        }
    };

    trace!("Process outgoing channel closed");
    result
}
/// Helper function that loops, processing outgoing stdin requests to a remote process as well as
/// supporting a kill request to terminate the remote process
Helper function that loops, processing outgoing stdin requests to a remote process as well as
supporting a kill request to terminate the remote process
Helper function that loops processing outgoing stdin requests to a remote process as well as supporting a kill request to terminate the remote process
async fn process_outgoing_requests(
    tenant: String,
    id: usize,
    mut channel: SessionChannel,
    mut stdin_rx: mpsc::Receiver<Vec<u8>>,
    mut kill_rx: mpsc::Receiver<()>,
) -> Result<(), RemoteProcessError> {
    let result = loop {
        tokio::select! {
            data = stdin_rx.recv() => {
                match data {
                    Some(data) => channel.fire(
                        Request::new(
                            tenant.as_str(),
                            vec![RequestData::ProcStdin { id, data }]
                        )
                    ).await?,
                    None => break Err(RemoteProcessError::ChannelDead),
                }
            }
            msg = kill_rx.recv() => {
                if msg.is_some() {
                    channel.fire(Request::new(
                        tenant.as_str(),
                        vec![RequestData::ProcKill { id }],
                    )).await?;
                    break Ok(());
                } else {
                    break Err(RemoteProcessError::ChannelDead);
                }
            }
        }
    };
    trace!("Process outgoing channel closed");
    result
}
async fn process_outgoing_requests ( tenant : String , id : usize , mut channel : SessionChannel , mut stdin_rx : mpsc :: Receiver < Vec < u8 > > , mut kill_rx : mpsc :: Receiver < ( ) > , ) -> Result < ( ) , RemoteProcessError > { let result = loop { tokio :: select ! { data stdin_rx recv ( ) { match data { Some ( data ) channel fire ( Request new ( tenant as_str ( ) vec [ RequestData ProcStdin { id data } ] ) ) await None break Err ( RemoteProcessError ChannelDead ) } } msg kill_rx recv ( ) { if msg is_some ( ) { channel fire ( Request new ( tenant as_str ( ) vec [ RequestData ProcKill { id } ] ) ) await break Ok ( ( ) ) } else { break Err ( RemoteProcessError ChannelDead ) } } } } ; trace ! ( " " ) ; result }
Helper function that loops, processing outgoing stdin requests to a remote process as well as
supporting a kill request to terminate the remote process
Helper function that loops processing outgoing stdin requests to a remote process as well as supporting a kill request to terminate the remote process
tenant
String
id
usize
channel
SessionChannel
stdin_rx
mpsc::Receiver<Vec<u8>>
kill_rx
mpsc::Receiver<()>