mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
Upgrade to libp2p 0.44.0 (#11009)
* Update libp2p to 0.43.0, lru to 0.7.3 * Fix websoket Incoming::Data * Rename ProtocolsHandler -> ConnectionHandler, remove inject_dis/connected, minor fixes * Fix args for inject_connection* callbacks * Fix DialPeer/DialAddress * Fix debug fmt * Add Endpoint to NetworkState * Fix Kad::get_record by key * Fix Sha2_256::digest * Fix IntoConnectionHandler * Fix borrowchk * Fix DialError::WrongPeerId * Remove NodeHandlerWrapperError * Fix KademliaEvent variants * Fix impl Add for String * Fix tabs in network_state * Apply cargo fmt * Fix a typo in req/resp * Fix tests * Fix peer_info:entry.info_expire * Fix PeerInfoBehaviour inject_address_change and inject_connection_closed * Patch libp2p to 0.44.0#6cc3b4e * Fix inject_connection_closed kad, req/resp * Apply cargo fmt * Use libp2p from crates.io * Fix review notes
This commit is contained in:
@@ -29,8 +29,8 @@ use libp2p::{
|
||||
},
|
||||
identity, noise,
|
||||
swarm::{
|
||||
DialError, IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters,
|
||||
ProtocolsHandler, Swarm, SwarmEvent,
|
||||
ConnectionHandler, DialError, IntoConnectionHandler, NetworkBehaviour,
|
||||
NetworkBehaviourAction, PollParameters, Swarm, SwarmEvent,
|
||||
},
|
||||
yamux, Multiaddr, PeerId, Transport,
|
||||
};
|
||||
@@ -133,10 +133,10 @@ impl std::ops::DerefMut for CustomProtoWithAddr {
|
||||
}
|
||||
|
||||
impl NetworkBehaviour for CustomProtoWithAddr {
|
||||
type ProtocolsHandler = <Notifications as NetworkBehaviour>::ProtocolsHandler;
|
||||
type ConnectionHandler = <Notifications as NetworkBehaviour>::ConnectionHandler;
|
||||
type OutEvent = <Notifications as NetworkBehaviour>::OutEvent;
|
||||
|
||||
fn new_handler(&mut self) -> Self::ProtocolsHandler {
|
||||
fn new_handler(&mut self) -> Self::ConnectionHandler {
|
||||
self.inner.new_handler()
|
||||
}
|
||||
|
||||
@@ -150,23 +150,21 @@ impl NetworkBehaviour for CustomProtoWithAddr {
|
||||
list
|
||||
}
|
||||
|
||||
fn inject_connected(&mut self, peer_id: &PeerId) {
|
||||
self.inner.inject_connected(peer_id)
|
||||
}
|
||||
|
||||
fn inject_disconnected(&mut self, peer_id: &PeerId) {
|
||||
self.inner.inject_disconnected(peer_id)
|
||||
}
|
||||
|
||||
fn inject_connection_established(
|
||||
&mut self,
|
||||
peer_id: &PeerId,
|
||||
conn: &ConnectionId,
|
||||
endpoint: &ConnectedPoint,
|
||||
failed_addresses: Option<&Vec<Multiaddr>>,
|
||||
other_established: usize,
|
||||
) {
|
||||
self.inner
|
||||
.inject_connection_established(peer_id, conn, endpoint, failed_addresses)
|
||||
self.inner.inject_connection_established(
|
||||
peer_id,
|
||||
conn,
|
||||
endpoint,
|
||||
failed_addresses,
|
||||
other_established,
|
||||
)
|
||||
}
|
||||
|
||||
fn inject_connection_closed(
|
||||
@@ -174,16 +172,18 @@ impl NetworkBehaviour for CustomProtoWithAddr {
|
||||
peer_id: &PeerId,
|
||||
conn: &ConnectionId,
|
||||
endpoint: &ConnectedPoint,
|
||||
handler: <Self::ProtocolsHandler as IntoProtocolsHandler>::Handler,
|
||||
handler: <Self::ConnectionHandler as IntoConnectionHandler>::Handler,
|
||||
remaining_established: usize,
|
||||
) {
|
||||
self.inner.inject_connection_closed(peer_id, conn, endpoint, handler)
|
||||
self.inner
|
||||
.inject_connection_closed(peer_id, conn, endpoint, handler, remaining_established)
|
||||
}
|
||||
|
||||
fn inject_event(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
connection: ConnectionId,
|
||||
event: <<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::OutEvent,
|
||||
event: <<Self::ConnectionHandler as IntoConnectionHandler>::Handler as ConnectionHandler>::OutEvent,
|
||||
) {
|
||||
self.inner.inject_event(peer_id, connection, event)
|
||||
}
|
||||
@@ -192,14 +192,14 @@ impl NetworkBehaviour for CustomProtoWithAddr {
|
||||
&mut self,
|
||||
cx: &mut Context,
|
||||
params: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ProtocolsHandler>> {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>> {
|
||||
self.inner.poll(cx, params)
|
||||
}
|
||||
|
||||
fn inject_dial_failure(
|
||||
&mut self,
|
||||
peer_id: Option<PeerId>,
|
||||
handler: Self::ProtocolsHandler,
|
||||
handler: Self::ConnectionHandler,
|
||||
error: &DialError,
|
||||
) {
|
||||
self.inner.inject_dial_failure(peer_id, handler, error)
|
||||
|
||||
Reference in New Issue
Block a user