chiark / gitweb /
ipif: wip break out, rename fields
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 23:57:25 +0000 (00:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 23:57:25 +0000 (00:57 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bin/client.rs
src/ipif.rs

index 9c139d28ef8c6e48e9049b32a8a9b22355864b32..82ad799e6d4795e19aee8f76bd076b18e384ffba 100644 (file)
@@ -203,7 +203,7 @@ async fn run_client<C:HCC>(
       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<C:HCC>(
           let _ = tx_queue.pop_front();
         },
 
-        data = ipif.tx_stream.next_segment(),
+        data = ipif.tx.next_segment(),
         if tx_queue.is_empty() =>
         {
           let data = (||{
index b21ab608ccd4cdaf3961d7cf67a3f78a7ef11038..196b6b38ac7015945705f67bd502c0627bab3c8d 100644 (file)
@@ -5,8 +5,8 @@
 use crate::prelude::*;
 
 pub struct Ipif {
-  pub tx_stream: t_io::Split<t_io::BufReader<t_proc::ChildStdout>>,
-  pub rx_stream: t_proc::ChildStdin,
+  pub tx: t_io::Split<t_io::BufReader<t_proc::ChildStdout>>,
+  pub rx: t_proc::ChildStdin,
   stderr_task: tokio::task::JoinHandle<io::Result<()>>,
   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),