#[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,
{
debug!("{}: config: {:?}", &ic, &ic);
+ let mut reporter = Reporter { };
+
let mut ipif = tokio::process::Command::new("sh")
.args(&["-c", &ic.ipif])
.stdin (process::Stdio::piped())
}
upbound_total = new_upbound_total;
upbound.push(packet);
- // we rely on `next_segment` being cancellation-safe,
+ // we rely oin `next_segment` being cancellation-safe,
// which isn't documented as true but seems reasonably safe
pin!{ let next_segment = tx_stream.next_segment(); }
to_process = match poll!(next_segment) {
).context("construct request")?;
let resp = hclient.request(req);
- let fut = Box::pin(tokio::timeout(
+ let fut = Box::pin(tokio::time::timeout(
ic.http_timeout,
async {
let r = async {
let resp = resp.await;
if ! resp.status().is_success() {
- throw!("HTTP error status {}: {}", &resp.status());
+ throw!(anyhow!("HTTP error status {}", &resp.status()));
}
let resp = resp.into_body();
// xxx: some size limit to avoid mallocing the universe
reqs.push(fut);
}
- (got, goti, _) = future::select_all(&mut reqs)
+ (got, goti, _) = future::select_all(&mut reqs) =>
{
reqs.swap_remove(goti);
if let Some(got) = reporter.report(got) {
--- /dev/null
+// Copyright 2021 Ian Jackson and contributors to Hippotat
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+use crate::prelude::*;
+
+pub struct Reporter {
+}
+
+impl Reporter {
+ pub fn report<T>(r: Result<T,AE>) -> Option<T> {
+ match r {
+ Ok(t) => {
+ // xxx something something success
+ Some(t)
+ },
+ Err(e) => {
+ // xxx something something error
+ error!("ERRO {:?}R", e);
+ None
+ },
+ }
+ }
+}