mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
committed by
Bastian Köcher
parent
6142f95611
commit
9ae3082ef0
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
derive_more = "0.14.0"
|
||||
crossbeam-channel = "0.3.4"
|
||||
libp2p = { version = "0.8.1", default-features = false }
|
||||
libp2p = { version = "0.9.0", default-features = false }
|
||||
log = "0.4"
|
||||
primitives = { package = "substrate-primitives", path= "../../primitives" }
|
||||
inherents = { package = "substrate-inherents", path = "../../inherents" }
|
||||
|
||||
@@ -12,7 +12,7 @@ byteorder = "1.3"
|
||||
bytes = "0.4"
|
||||
fnv = "1.0"
|
||||
futures = "0.1"
|
||||
libp2p = { version = "0.8.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] }
|
||||
libp2p = { version = "0.9.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] }
|
||||
parking_lot = "0.7.1"
|
||||
lazy_static = "1.2"
|
||||
log = "0.4"
|
||||
|
||||
@@ -67,7 +67,7 @@ impl<TBehaviour, TBehaviourEv, TSubstream> Behaviour<TBehaviour, TBehaviourEv, T
|
||||
|
||||
let mut kademlia = Kademlia::new(local_public_key.clone().into_peer_id());
|
||||
for (peer_id, addr) in &known_addresses {
|
||||
kademlia.add_connected_address(peer_id, addr.clone());
|
||||
kademlia.add_address(peer_id, addr.clone());
|
||||
}
|
||||
|
||||
if enable_mdns {
|
||||
@@ -104,7 +104,7 @@ impl<TBehaviour, TBehaviourEv, TSubstream> Behaviour<TBehaviour, TBehaviourEv, T
|
||||
}
|
||||
|
||||
/// Returns the list of nodes that we know exist in the network.
|
||||
pub fn known_peers(&self) -> impl Iterator<Item = &PeerId> {
|
||||
pub fn known_peers(&mut self) -> impl Iterator<Item = &PeerId> {
|
||||
self.discovery.kademlia.kbuckets_entries()
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ impl<TBehaviour, TBehaviourEv, TSubstream> NetworkBehaviourEventProcess<debug_in
|
||||
info.listen_addrs.truncate(30);
|
||||
}
|
||||
for addr in &info.listen_addrs {
|
||||
self.discovery.kademlia.add_connected_address(&peer_id, addr.clone());
|
||||
self.discovery.kademlia.add_address(&peer_id, addr.clone());
|
||||
}
|
||||
self.user_protocol.0.add_discovered_nodes(iter::once(peer_id.clone()));
|
||||
}
|
||||
@@ -188,8 +188,10 @@ impl<TBehaviour, TBehaviourEv, TSubstream> NetworkBehaviourEventProcess<Kademlia
|
||||
results");
|
||||
}
|
||||
}
|
||||
// We never start any GET_PROVIDERS query.
|
||||
KademliaOut::GetProvidersResult { .. } => ()
|
||||
// We never start any other type of query.
|
||||
KademliaOut::GetProvidersResult { .. } => {}
|
||||
KademliaOut::GetValueResult(_) => {}
|
||||
KademliaOut::PutValueResult(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
use futures::prelude::*;
|
||||
use libp2p::{
|
||||
InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport,
|
||||
mplex, identity, secio, yamux, websocket, bandwidth, wasm_ext
|
||||
mplex, identity, secio, yamux, bandwidth, wasm_ext
|
||||
};
|
||||
#[cfg(not(target_os = "unknown"))]
|
||||
use libp2p::{tcp, dns};
|
||||
use libp2p::{tcp, dns, websocket};
|
||||
use libp2p::core::{self, transport::boxed::Boxed, transport::OptionalTransport, muxing::StreamMuxerBox};
|
||||
use std::{io, sync::Arc, time::Duration, usize};
|
||||
|
||||
@@ -68,7 +68,9 @@ pub fn build_transport(
|
||||
.map(|(id, muxer)| (id, core::muxing::StreamMuxerBox::new(muxer)))
|
||||
})
|
||||
.with_timeout(Duration::from_secs(20))
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
|
||||
// TODO: pass the error directly, instead of calling `to_string()`
|
||||
// https://github.com/libp2p/rust-libp2p/issues/1162
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err.to_string()))
|
||||
.boxed();
|
||||
|
||||
(transport, sinks)
|
||||
|
||||
@@ -9,7 +9,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.1"
|
||||
libp2p = { version = "0.8.1", default-features = false }
|
||||
libp2p = { version = "0.9.0", default-features = false }
|
||||
linked-hash-map = "0.5"
|
||||
log = "0.4"
|
||||
lru-cache = "0.1.2"
|
||||
|
||||
Reference in New Issue
Block a user