fix errors (2)

This commit is contained in:
Henry de Valence 2020-11-24 14:50:02 -08:00
parent 527f4d39ed
commit 77bf327b07
2 changed files with 8 additions and 10 deletions

View File

@ -62,7 +62,7 @@ pub struct Inbound {
address_book: Option<Arc<Mutex<zn::AddressBook>>>,
state: State,
verifier: Verifier,
downloads: Option<Downloads<Outbound, Verifier, State>>,
downloads: Option<Pin<Box<Downloads<Outbound, Verifier, State>>>>,
}
impl Inbound {
@ -102,11 +102,11 @@ impl Service<zn::Request> for Inbound {
self.outbound = Some(outbound);
self.address_book = Some(address_book);
self.network_setup = None;
self.downloads = Some(Downloads::new(
self.downloads = Some(Box::pin(Downloads::new(
self.outbound.clone().unwrap(),
self.verifier.clone(),
self.state.clone(),
));
)));
}
Err(TryRecvError::Empty) => {
self.network_setup = Some(rx);
@ -123,8 +123,7 @@ impl Service<zn::Request> for Inbound {
// Clean up completed download tasks
if let Some(downloads) = self.downloads.as_mut() {
let downloads = Pin::new(downloads);
while let Poll::Ready(Some(_)) = downloads.poll_next(cx) {}
while let Poll::Ready(Some(_)) = downloads.as_mut().poll_next(cx) {}
}
// Now report readiness based on readiness of the inner services, if they're available.

View File

@ -5,7 +5,6 @@ use std::{
task::{Context, Poll},
};
use color_eyre::eyre::{eyre, Report};
use futures::{
future::TryFutureExt,
ready,
@ -27,11 +26,11 @@ type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
#[derive(Debug)]
pub struct Downloads<ZN, ZV, ZS>
where
ZN: Service<zn::Request, Response = zn::Response, Error = BoxError> + Send + 'static,
ZN: Service<zn::Request, Response = zn::Response, Error = BoxError> + Send + Clone + 'static,
ZN::Future: Send,
ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
ZV::Future: Send,
ZS: Service<zs::Request, Response = zs::Response, Error = BoxError> + Send + 'static,
ZS: Service<zs::Request, Response = zs::Response, Error = BoxError> + Send + Clone + 'static,
ZS::Future: Send,
{
network: ZN,
@ -44,11 +43,11 @@ where
impl<ZN, ZV, ZS> Stream for Downloads<ZN, ZV, ZS>
where
ZN: Service<zn::Request, Response = zn::Response, Error = BoxError> + Send + 'static,
ZN: Service<zn::Request, Response = zn::Response, Error = BoxError> + Send + Clone + 'static,
ZN::Future: Send,
ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
ZV::Future: Send,
ZS: Service<zs::Request, Response = zs::Response, Error = BoxError> + Send + 'static,
ZS: Service<zs::Request, Response = zs::Response, Error = BoxError> + Send + Clone + 'static,
ZS::Future: Send,
{
type Item = Result<block::Hash, BoxError>;