Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

client/network: Remove unused Result returned by NetworkWorker #6552

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnbound
use std::{
borrow::{Borrow, Cow},
collections::HashSet,
fs, io,
fs,
marker::PhantomData,
num:: NonZeroUsize,
pin::Pin,
Expand Down Expand Up @@ -1111,7 +1111,7 @@ impl Metrics {
}

impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
type Output = Result<(), io::Error>;
type Output = ();

fn poll(mut self: Pin<&mut Self>, cx: &mut std::task::Context) -> Poll<Self::Output> {
let this = &mut *self;
Expand All @@ -1138,7 +1138,7 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
// Process the next message coming from the `NetworkService`.
let msg = match this.from_worker.poll_next_unpin(cx) {
Poll::Ready(Some(msg)) => msg,
Poll::Ready(None) => return Poll::Ready(Ok(())),
Poll::Ready(None) => return Poll::Ready(()),
Poll::Pending => break,
};

Expand Down
6 changes: 3 additions & 3 deletions client/network/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,13 +861,13 @@ pub trait TestNetFactory: Sized {
);
}

/// Polls the testnet. Processes all the pending actions and returns `NotReady`.
/// Polls the testnet. Processes all the pending actions.
fn poll(&mut self, cx: &mut FutureContext) {
self.mut_peers(|peers| {
for peer in peers {
trace!(target: "sync", "-- Polling {}", peer.id());
if let Poll::Ready(res) = Pin::new(&mut peer.network).poll(cx) {
res.unwrap();
if let Poll::Ready(()) = peer.network.poll_unpin(cx) {
panic!("NetworkWorker has terminated unexpectedly.")
}
trace!(target: "sync", "-- Polling complete {}", peer.id());

Expand Down
4 changes: 1 addition & 3 deletions client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ fn build_network_future<
});

// Main network polling.
if let Poll::Ready(Ok(())) = Pin::new(&mut network).poll(cx).map_err(|err| {
warn!(target: "service", "Error in network: {:?}", err);
}) {
if let Poll::Ready(()) = network.poll_unpin(cx) {
return Poll::Ready(());
}

Expand Down