From: Ian Jackson Date: Sat, 7 Aug 2021 23:57:25 +0000 (+0100) Subject: ipif: wip break out, rename fields X-Git-Tag: hippotat/1.0.0~246 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=2175e8542a9285aa2cb7c779a09ac9566cc48364;p=hippotat.git ipif: wip break out, rename fields Signed-off-by: Ian Jackson --- diff --git a/src/bin/client.rs b/src/bin/client.rs index 9c139d2..82ad799 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -203,7 +203,7 @@ async fn run_client( select! { biased; - y = ipif.rx_stream.write_all_buf(&mut rx_queue), + y = ipif.rx.write_all_buf(&mut rx_queue), if ! rx_queue.is_empty() => { let () = y.context("write rx data to ipif")?; @@ -218,7 +218,7 @@ async fn run_client( let _ = tx_queue.pop_front(); }, - data = ipif.tx_stream.next_segment(), + data = ipif.tx.next_segment(), if tx_queue.is_empty() => { let data = (||{ diff --git a/src/ipif.rs b/src/ipif.rs index b21ab60..196b6b3 100644 --- a/src/ipif.rs +++ b/src/ipif.rs @@ -5,8 +5,8 @@ use crate::prelude::*; pub struct Ipif { - pub tx_stream: t_io::Split>, - pub rx_stream: t_proc::ChildStdin, + pub tx: t_io::Split>, + pub rx: t_proc::ChildStdin, stderr_task: tokio::task::JoinHandle>, child: t_proc::Child, } @@ -32,20 +32,20 @@ impl Ipif { Ok::<_,io::Error>(()) }); - let tx_stream = child.stdout.take().unwrap(); - let rx_stream = child.stdin .take().unwrap(); - let tx_stream = t_io::BufReader::new(tx_stream).split(SLIP_END); + let tx = child.stdout.take().unwrap(); + let rx = child.stdin .take().unwrap(); + let tx = t_io::BufReader::new(tx).split(SLIP_END); Ipif { - tx_stream, - rx_stream, + tx, + rx, stderr_task, child, } } pub async fn quitting(mut self, ic: &InstanceConfig) { - drop(self.tx_stream); + drop(self.tx); match self.child.wait().await { Err(e) => error!("{}: also, failed to await ipif child: {}", &ic, e),