chiark / gitweb /
forward
[hippotat.git] / server / slocal.rs
index 893a0700050bd5d27f6c4faf2efabb0f58deef38..eaa7adaa4ef5819a8e0ce39061cdb333ca372cb3 100644 (file)
@@ -7,7 +7,7 @@ use super::*;
 #[allow(dead_code)] // xxx
 #[allow(unused_variables)] // xxx
 pub async fn run(global: Arc<Global>,
-                 rx: mpsc::Receiver<RoutedPacket>,
+                 mut rx: mpsc::Receiver<RoutedPacket>,
                  mut ipif: Ipif) -> Result<Void,AE> {
   let r = async {
     let mut goodness: i32 = 0;
@@ -18,7 +18,15 @@ pub async fn run(global: Arc<Global>,
       select!{
         biased;
 
-        // xxx something something rx something
+        data = rx.recv() =>
+        {
+          let data = data.ok_or_else(|| anyhow!("rx stream end!"))?;
+          let mut data = &*data.data;
+          let mut slip_end = &[SLIP_END][..];
+          let mut buf = Buf::chain(&mut data, &mut slip_end);
+          ipif.rx.write_all_buf(&mut buf).await
+            .context("write to ipif")?;
+        },
 
         data = Ipif::next_frame(&mut ipif.tx) =>
         {
@@ -65,7 +73,7 @@ pub async fn run(global: Arc<Global>,
               }
             },
           }
-        }
+        },
       }
     }
   }.await;