This commit is contained in:
David Craven 2020-03-21 12:52:51 -03:00
parent 1e96deab76
commit 8889b0de12
7 changed files with 8 additions and 16 deletions

View File

@ -63,10 +63,8 @@ use ipfs::{IpfsOptions, IpfsPath, Ipld, Types, UninitializedIpfs};
use libipld::ipld;
fn main() {
env_logger::init();
let options = IpfsOptions::<Types>::default();
env_logger::Builder::new()
.parse_filters(&options.ipfs_log)
.init();
task::block_on(async move {
// Start daemon and initialize repo

View File

@ -4,10 +4,8 @@ use ipfs::{IpfsOptions, Types, UninitializedIpfs};
use libipld::ipld;
fn main() {
env_logger::init();
let options = IpfsOptions::<Types>::default();
env_logger::Builder::new()
.parse_filters(&options.ipfs_log)
.init();
task::block_on(async move {
let (ipfs, fut) = UninitializedIpfs::new(options).await.start().await.unwrap();

View File

@ -4,10 +4,8 @@ use ipfs::{IpfsOptions, IpfsPath, TestTypes, UninitializedIpfs};
use std::str::FromStr;
fn main() {
env_logger::init();
let options = IpfsOptions::<TestTypes>::default();
env_logger::Builder::new()
.parse_filters(&options.ipfs_log)
.init();
let path =
IpfsPath::from_str("/ipfs/zdpuB1caPcm4QNXeegatVfLQ839Lmprd5zosXGwRUBJHwj66X").unwrap();

View File

@ -5,10 +5,8 @@ use multihash::Sha2_256;
use std::convert::TryInto;
fn main() {
env_logger::init();
let options = IpfsOptions::<TestTypes>::default();
env_logger::Builder::new()
.parse_filters(&options.ipfs_log)
.init();
task::block_on(async move {
// Start daemon and initialize repo

View File

@ -3,10 +3,8 @@ use ipfs::{IpfsOptions, IpfsPath, PeerId, TestTypes, UninitializedIpfs};
use std::str::FromStr;
fn main() {
env_logger::init();
let options = IpfsOptions::<TestTypes>::default();
env_logger::Builder::new()
.parse_filters(&options.ipfs_log)
.init();
task::block_on(async move {
// Start daemon and initialize repo

View File

@ -151,6 +151,7 @@ impl ConfigFile {
}
pub fn store_at<P: AsRef<Path>>(&self, path: P) -> std::io::Result<()> {
fs::create_dir_all(path.as_ref().parent().unwrap())?;
let string = serde_json::to_string_pretty(self).unwrap();
fs::write(path, string)
}

View File

@ -22,7 +22,7 @@ pub struct Disconnector {
impl Disconnector {
pub fn disconnect<T: NetworkBehaviour>(self, swarm: &mut Swarm<T>) {
Swarm::ban_peer_id(swarm, self.peer_id.clone());
Swarm::unban_peer_id(swarm, self.peer_id.clone());
Swarm::unban_peer_id(swarm, self.peer_id);
}
}
@ -144,6 +144,7 @@ impl NetworkBehaviour for SwarmApi {
.finish_subscription(addr, Err(format!("{}", error)));
}
#[allow(clippy::type_complexity)]
fn poll(&mut self, _ctx: &mut Context, _: &mut impl PollParameters) -> Poll<NetworkBehaviourAction<<<
Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent, Self::OutEvent>>{
log::trace!("poll");