This commit is contained in:
Henry de Valence 2020-02-18 11:32:25 -08:00 committed by Deirdre Connolly
parent 272c3479a8
commit afa2c2347f
5 changed files with 22 additions and 9 deletions

View File

@ -93,7 +93,7 @@ pub enum Transaction {
impl Transaction { impl Transaction {
/// Iterate over the transparent inputs of this transaction, if any. /// Iterate over the transparent inputs of this transaction, if any.
pub fn inputs(&self) -> impl Iterator<Item=&TransparentInput> { pub fn inputs(&self) -> impl Iterator<Item = &TransparentInput> {
match self { match self {
Transaction::V1 { ref inputs, .. } => inputs.iter(), Transaction::V1 { ref inputs, .. } => inputs.iter(),
Transaction::V2 { ref inputs, .. } => inputs.iter(), Transaction::V2 { ref inputs, .. } => inputs.iter(),
@ -103,7 +103,7 @@ impl Transaction {
} }
/// Iterate over the transparent outputs of this transaction, if any. /// Iterate over the transparent outputs of this transaction, if any.
pub fn outputs(&self) -> impl Iterator<Item=&TransparentOutput> { pub fn outputs(&self) -> impl Iterator<Item = &TransparentOutput> {
match self { match self {
Transaction::V1 { ref outputs, .. } => outputs.iter(), Transaction::V1 { ref outputs, .. } => outputs.iter(),
Transaction::V2 { ref outputs, .. } => outputs.iter(), Transaction::V2 { ref outputs, .. } => outputs.iter(),

View File

@ -52,9 +52,9 @@ mod config;
mod constants; mod constants;
mod meta_addr; mod meta_addr;
mod network; mod network;
mod policies;
mod peer; mod peer;
mod peer_set; mod peer_set;
mod policies;
mod protocol; mod protocol;
mod timestamp_collector; mod timestamp_collector;
@ -62,8 +62,8 @@ pub use crate::{
address_book::AddressBook, address_book::AddressBook,
config::Config, config::Config,
peer_set::init, peer_set::init,
protocol::internal::{Request, Response},
policies::{RetryErrors, RetryLimit}, policies::{RetryErrors, RetryLimit},
protocol::internal::{Request, Response},
}; };
/// Types used in the definition of [`Request`] and [`Response`] messages. /// Types used in the definition of [`Request`] and [`Response`] messages.

View File

@ -197,7 +197,14 @@ where
/// Given a channel that signals a need for new peers, try to connect to a peer /// Given a channel that signals a need for new peers, try to connect to a peer
/// and send the resulting `peer::Client` through a channel. /// and send the resulting `peer::Client` through a channel.
#[instrument(skip(new_peer_interval, demand_tx, demand_rx, candidates, connector, success_tx))] #[instrument(skip(
new_peer_interval,
demand_tx,
demand_rx,
candidates,
connector,
success_tx
))]
async fn crawl_and_dial<C, S>( async fn crawl_and_dial<C, S>(
new_peer_interval: std::time::Duration, new_peer_interval: std::time::Duration,
mut demand_tx: mpsc::Sender<()>, mut demand_tx: mpsc::Sender<()>,
@ -213,7 +220,13 @@ where
S: Service<Request, Response = Response, Error = BoxedStdError>, S: Service<Request, Response = Response, Error = BoxedStdError>,
S::Future: Send + 'static, S::Future: Send + 'static,
{ {
use futures::{future::{select, Either::{Left, Right}}, TryFutureExt}; use futures::{
future::{
select,
Either::{Left, Right},
},
TryFutureExt,
};
let mut handshakes = FuturesUnordered::new(); let mut handshakes = FuturesUnordered::new();
// <FuturesUnordered as Stream> returns None when empty. // <FuturesUnordered as Stream> returns None when empty.

View File

@ -1,5 +1,5 @@
use tower::retry::Policy;
use futures::future; use futures::future;
use tower::retry::Policy;
/// A very basic retry policy with a limited number of retry attempts. /// A very basic retry policy with a limited number of retry attempts.
/// ///

View File

@ -28,11 +28,11 @@ impl Runnable for ConfigCmd {
" "
.to_owned(); // The default name and location of the config file is defined in ../commands.rs .to_owned(); // The default name and location of the config file is defined in ../commands.rs
// this avoids a ValueAfterTable error // this avoids a ValueAfterTable error
// https://github.com/alexcrichton/toml-rs/issues/145 // https://github.com/alexcrichton/toml-rs/issues/145
let conf = toml::Value::try_from(default_config).unwrap(); let conf = toml::Value::try_from(default_config).unwrap();
output += &toml::to_string_pretty(&conf) output += &toml::to_string_pretty(&conf).expect("default config should be serializable");
.expect("default config should be serializable");
match self.output_file { match self.output_file {
Some(ref output_file) => { Some(ref output_file) => {
use std::{fs::File, io::Write}; use std::{fs::File, io::Write};