X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=server%2Fslocal.rs;h=eaa7adaa4ef5819a8e0ce39061cdb333ca372cb3;hb=88399f1adaf0fffc8a593745ff07ca55727e09e5;hp=893a0700050bd5d27f6c4faf2efabb0f58deef38;hpb=dd09e07c06d4d1b500296dbaaad3949c93814b9b;p=hippotat.git diff --git a/server/slocal.rs b/server/slocal.rs index 893a070..eaa7ada 100644 --- a/server/slocal.rs +++ b/server/slocal.rs @@ -7,7 +7,7 @@ use super::*; #[allow(dead_code)] // xxx #[allow(unused_variables)] // xxx pub async fn run(global: Arc, - rx: mpsc::Receiver, + mut rx: mpsc::Receiver, mut ipif: Ipif) -> Result { let r = async { let mut goodness: i32 = 0; @@ -18,7 +18,15 @@ pub async fn run(global: Arc, 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, } }, } - } + }, } } }.await;