fix errors (2)
This commit is contained in:
parent
527f4d39ed
commit
77bf327b07
|
|
@ -62,7 +62,7 @@ pub struct Inbound {
|
||||||
address_book: Option<Arc<Mutex<zn::AddressBook>>>,
|
address_book: Option<Arc<Mutex<zn::AddressBook>>>,
|
||||||
state: State,
|
state: State,
|
||||||
verifier: Verifier,
|
verifier: Verifier,
|
||||||
downloads: Option<Downloads<Outbound, Verifier, State>>,
|
downloads: Option<Pin<Box<Downloads<Outbound, Verifier, State>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Inbound {
|
impl Inbound {
|
||||||
|
|
@ -102,11 +102,11 @@ impl Service<zn::Request> for Inbound {
|
||||||
self.outbound = Some(outbound);
|
self.outbound = Some(outbound);
|
||||||
self.address_book = Some(address_book);
|
self.address_book = Some(address_book);
|
||||||
self.network_setup = None;
|
self.network_setup = None;
|
||||||
self.downloads = Some(Downloads::new(
|
self.downloads = Some(Box::pin(Downloads::new(
|
||||||
self.outbound.clone().unwrap(),
|
self.outbound.clone().unwrap(),
|
||||||
self.verifier.clone(),
|
self.verifier.clone(),
|
||||||
self.state.clone(),
|
self.state.clone(),
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
Err(TryRecvError::Empty) => {
|
Err(TryRecvError::Empty) => {
|
||||||
self.network_setup = Some(rx);
|
self.network_setup = Some(rx);
|
||||||
|
|
@ -123,8 +123,7 @@ impl Service<zn::Request> for Inbound {
|
||||||
|
|
||||||
// Clean up completed download tasks
|
// Clean up completed download tasks
|
||||||
if let Some(downloads) = self.downloads.as_mut() {
|
if let Some(downloads) = self.downloads.as_mut() {
|
||||||
let downloads = Pin::new(downloads);
|
while let Poll::Ready(Some(_)) = downloads.as_mut().poll_next(cx) {}
|
||||||
while let Poll::Ready(Some(_)) = downloads.poll_next(cx) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now report readiness based on readiness of the inner services, if they're available.
|
// Now report readiness based on readiness of the inner services, if they're available.
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ use std::{
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
use color_eyre::eyre::{eyre, Report};
|
|
||||||
use futures::{
|
use futures::{
|
||||||
future::TryFutureExt,
|
future::TryFutureExt,
|
||||||
ready,
|
ready,
|
||||||
|
|
@ -27,11 +26,11 @@ type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Downloads<ZN, ZV, ZS>
|
pub struct Downloads<ZN, ZV, ZS>
|
||||||
where
|
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,
|
ZN::Future: Send,
|
||||||
ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
|
ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
|
||||||
ZV::Future: Send,
|
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,
|
ZS::Future: Send,
|
||||||
{
|
{
|
||||||
network: ZN,
|
network: ZN,
|
||||||
|
|
@ -44,11 +43,11 @@ where
|
||||||
|
|
||||||
impl<ZN, ZV, ZS> Stream for Downloads<ZN, ZV, ZS>
|
impl<ZN, ZV, ZS> Stream for Downloads<ZN, ZV, ZS>
|
||||||
where
|
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,
|
ZN::Future: Send,
|
||||||
ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
|
ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
|
||||||
ZV::Future: Send,
|
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,
|
ZS::Future: Send,
|
||||||
{
|
{
|
||||||
type Item = Result<block::Hash, BoxError>;
|
type Item = Result<block::Hash, BoxError>;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue