mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Update to libp2p v0.4 (#1836)
This commit is contained in:
@@ -246,7 +246,7 @@ impl<TMessage, TSubstream> NetworkBehaviourEventProcess<IdentifyEvent> for Behav
|
||||
info.listen_addrs.truncate(30);
|
||||
}
|
||||
for addr in &info.listen_addrs {
|
||||
self.discovery.kademlia.add_address(&peer_id, addr.clone());
|
||||
self.discovery.kademlia.add_connected_address(&peer_id, addr.clone());
|
||||
}
|
||||
self.custom_protocols.add_discovered_addrs(
|
||||
&peer_id,
|
||||
@@ -255,6 +255,10 @@ impl<TMessage, TSubstream> NetworkBehaviourEventProcess<IdentifyEvent> for Behav
|
||||
self.events.push(BehaviourOut::Identified { peer_id, info });
|
||||
}
|
||||
IdentifyEvent::Error { .. } => {}
|
||||
IdentifyEvent::SendBack { result: Err(ref err), ref peer_id } =>
|
||||
debug!(target: "sub-libp2p", "Error when sending back identify info \
|
||||
to {:?} => {}", peer_id, err),
|
||||
IdentifyEvent::SendBack { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ pub use crate::secret::obtain_private_key;
|
||||
pub use crate::service_task::{start_service, Service, ServiceEvent};
|
||||
pub use crate::traits::{NetworkConfiguration, NodeIndex, NodeId, NonReservedPeerMode};
|
||||
pub use crate::traits::{ProtocolId, Secret, Severity};
|
||||
pub use libp2p::{Multiaddr, multiaddr::{Protocol}, multiaddr, PeerId, core::PublicKey};
|
||||
pub use libp2p::{Multiaddr, multiaddr::Protocol, build_multiaddr, PeerId, core::PublicKey};
|
||||
|
||||
/// Check if node url is valid
|
||||
pub fn validate_node_url(url: &str) -> Result<(), Error> {
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::custom_proto::{CustomMessage, RegisteredProtocol, RegisteredProtocols
|
||||
use crate::{Error, NetworkConfiguration, NodeIndex, ProtocolId, parse_str_addr};
|
||||
use fnv::FnvHashMap;
|
||||
use futures::{prelude::*, Stream};
|
||||
use libp2p::{multiaddr::Protocol, Multiaddr, PeerId, multiaddr};
|
||||
use libp2p::{multiaddr::Protocol, Multiaddr, PeerId, build_multiaddr};
|
||||
use libp2p::core::{Swarm, nodes::Substream, transport::boxed::Boxed, muxing::StreamMuxerBox};
|
||||
use libp2p::core::nodes::ConnectedPoint;
|
||||
use log::{debug, info, warn};
|
||||
@@ -88,8 +88,8 @@ where TProtos: IntoIterator<Item = RegisteredProtocol<TMessage>>,
|
||||
// If the format of the bootstrap node is not a multiaddr, try to parse it as
|
||||
// a `SocketAddr`. This corresponds to the format `IP:PORT`.
|
||||
let addr = match bootnode.parse::<SocketAddr>() {
|
||||
Ok(SocketAddr::V4(socket)) => multiaddr![Ip4(*socket.ip()), Tcp(socket.port())],
|
||||
Ok(SocketAddr::V6(socket)) => multiaddr![Ip6(*socket.ip()), Tcp(socket.port())],
|
||||
Ok(SocketAddr::V4(socket)) => build_multiaddr![Ip4(*socket.ip()), Tcp(socket.port())],
|
||||
Ok(SocketAddr::V6(socket)) => build_multiaddr![Ip6(*socket.ip()), Tcp(socket.port())],
|
||||
_ => {
|
||||
warn!(target: "sub-libp2p", "Not a valid bootnode address: {}", bootnode);
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user