chiark / gitweb /
client: wip code
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Jul 2021 00:37:12 +0000 (01:37 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Jul 2021 00:37:12 +0000 (01:37 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bin/client.rs
src/prelude.rs
src/slip.rs

index 9e9028ca33aff9cb03a073e74f989352e738ad7e..3feefc0fef8c1a18d66a41625c034eff0f7f7441 100644 (file)
@@ -14,7 +14,7 @@ struct Client {
 #[allow(unused_variables)] // xxx
 async fn run_client<C>(ic: InstanceConfig, hclient: Arc<hyper::Client<C>>)
                        -> Result<Void, AE>
-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>)
             )
           );
 
index f1afa4ee99a74364503cca54ea783cc8b45953c3..7194967da6250dc5ef4f36ff02619b15af061b6c 100644 (file)
@@ -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;
index 0de09478d0afdc5c80e83b18334ea74e962a7fd9..269c8fe401423b6737d22076fa3cc018314cd0c7 100644 (file)
@@ -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