From 3a2585065ef2449e84656a63d093af97ea07ce7a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 29 Jul 2021 01:37:12 +0100 Subject: [PATCH] client: wip code Signed-off-by: Ian Jackson --- src/bin/client.rs | 8 ++++---- src/prelude.rs | 2 +- src/slip.rs | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bin/client.rs b/src/bin/client.rs index 9e9028c..3feefc0 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -14,7 +14,7 @@ struct Client { #[allow(unused_variables)] // xxx async fn run_client(ic: InstanceConfig, hclient: Arc>) -> Result -where C: hyper::client::connect::Connect + Clone + Send + Sync, +where C: hyper::client::connect::Connect + Clone + Send + Sync + 'static, { debug!("{}: config: {:?}", &ic, &ic); @@ -87,9 +87,9 @@ where C: hyper::client::connect::Connect + Clone + Send + Sync, let body = hyper::body::Body::wrap_stream( futures::stream::iter( Itertools::intersperse( - upbound.into_iter().map(|u| Cow::from(u)), - Cow::from(&[SLIP_END] as &'static [u8]) - ).map(Ok) + upbound.into_iter().map(|u| Bytes::from(u)), + slip::SLIP_END_SLICE.into() + ).map(Ok::<_,Void>) ) ); diff --git a/src/prelude.rs b/src/prelude.rs index f1afa4e..7194967 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -23,7 +23,7 @@ pub use anyhow::{anyhow, Context}; pub use extend::ext; pub use fehler::{throw, throws}; pub use futures::{poll, future}; -pub use hyper::body::{Buf as _}; +pub use hyper::body::{Bytes, Buf as _}; pub use hyper::Uri; pub use hyper_tls::HttpsConnector; pub use ipnet::IpNet; diff --git a/src/slip.rs b/src/slip.rs index 0de0947..269c8fe 100644 --- a/src/slip.rs +++ b/src/slip.rs @@ -4,6 +4,8 @@ use crate::prelude::*; +pub static SLIP_END_SLICE: &[u8] = &[SLIP_END]; + #[throws(AE)] pub fn check_checkmtu_mimeify(_data: &mut [u8], _ic: &InstanceConfig) { // xxx -- 2.30.2