assert!( to_process.is_none() );
dbg!(&reqs.len(), &upbound_total, &upbound.len());
- let req = hyper::Request::post(&ic.url)
- .body(
+ let body = hyper::body::Body::wrap_stream(
Itertools::intersperse(
upbound.into_iter().map(|u| Cow::from(u)),
Cow::from(&[SLIP_END] as &'static [u8])
- )
- ).context("construct request")?;
+ ).into()
+ );
+
+ let req = hyper::Request::post(&ic.url).body(body)
+ .context("construct request")?;
let resp = hclient.request(req);
let fut = Box::pin(tokio::time::timeout(
ic.http_timeout,
async {
let r = async {
- let resp = resp.await;
+ let resp = resp.await.context("make request")?;
if ! resp.status().is_success() {
throw!(anyhow!("HTTP error status {}", &resp.status()));
}
let resp = resp.into_body();
// xxx: some size limit to avoid mallocing the universe
- let resp = resp.aggregate().await
+ let resp = hyper::body::aggregate(resp).await
.context("HTTP error fetching response body")?;
Ok::<_,AE>(resp)
- };
+ }.await;
if r.is_err() {
- tokio::time::sleep(&ic.http_retry).await;
+ tokio::time::sleep(ic.http_retry).await;
}
r
}
}
impl Reporter {
- pub fn report<T>(r: Result<T,AE>) -> Option<T> {
+ pub fn report<T>(&mut self, r: Result<T,AE>) -> Option<T> {
match r {
Ok(t) => {
// xxx something something success