chiark / gitweb /
forward
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Aug 2021 01:03:16 +0000 (02:03 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Aug 2021 01:03:16 +0000 (02:03 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
server/slocal.rs
src/prelude.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;
index 0fd63053e025d31b824160c903151f9e4bb94033..10b39538f2a106e93a558757855da07a48c069d5 100644 (file)
@@ -29,7 +29,7 @@ pub use cervine::Cow as Cervine;
 pub use extend::ext;
 pub use fehler::{throw, throws};
 pub use futures::{poll, future, FutureExt, StreamExt, TryStreamExt};
-pub use hyper::body::{Bytes, Buf as _};
+pub use hyper::body::{Bytes, Buf};
 pub use hyper::{Method, Uri};
 pub use hyper_tls::HttpsConnector;
 pub use ipnet::IpNet;