INNER CODE UNIT · Rust
with_command_tx
eepnet/emissary · emissary-cli/src/proxy/http/mod.rs:391
async fn with_command_tx(cmd_tx: Sender<String>) -> Self {
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
Self {
listener,
cmd_tx: Some(cmd_tx),
}
}
/// Run the event loop of [`SamServer`].
async fn run(self) {
while let Ok((stream, _)) = self.listener.accept().await {
let tx = self.cmd_tx.clone();
tokio::spawn(async move {
let mut lines = BufReader::new(stream).lines();
while let Ok(Some(command)) = lines.next_line().await {