mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 00:57:57 +00:00
upgrade libp2p to 0.50.0 (#12734)
* upgrade libp2p to 0.50.0 * on_swarm_event and on_connection_handler_event * replace `Swarm::new` with `Swarm::with_threadpool_executor` * on_swarm_event and on_connection_handler_event part 2 * on_swarm_event and on_connection_handler_event part 3 * on_swarm_event and on_connection_handler_event part 4 * update libp2p * libp2p 0.50.0 * rename OutboundQueryCompleted to OutboundQueryProgressed refs https://github.com/libp2p/rust-libp2p/pull/2712 * remove unused var * accumulate outbound_query_records until query is finished * format code * use p_handler instead of new_handler https://github.com/paritytech/substrate/pull/12734#discussion_r1027640610 * pass ListenFailure to kademlia https://github.com/paritytech/substrate/pull/12734#discussion_r1034716664 * use tokio executor in tests https://github.com/paritytech/substrate/pull/12734#discussion_r1039291776 * use chrono Local::now instead of deprecated Local::today * remove unused vars from request_responses tests * attempt to fix pallet UI tests * restart CI * restart CI * restart CI * restart CI * restart CI * restart CI * restart CI * restart CI
This commit is contained in:
@@ -40,13 +40,13 @@ use crate::{
|
||||
|
||||
use futures::{channel::oneshot, prelude::*};
|
||||
use libp2p::{
|
||||
core::{either::EitherError, upgrade, ConnectedPoint, Executor},
|
||||
core::{either::EitherError, upgrade, ConnectedPoint},
|
||||
identify::Info as IdentifyInfo,
|
||||
kad::record::Key as KademliaKey,
|
||||
multiaddr,
|
||||
ping::Failure as PingFailure,
|
||||
swarm::{
|
||||
AddressScore, ConnectionError, ConnectionLimits, DialError, NetworkBehaviour,
|
||||
AddressScore, ConnectionError, ConnectionLimits, DialError, Executor, NetworkBehaviour,
|
||||
PendingConnectionError, Swarm, SwarmBuilder, SwarmEvent,
|
||||
},
|
||||
Multiaddr, PeerId,
|
||||
@@ -370,7 +370,21 @@ where
|
||||
}
|
||||
};
|
||||
|
||||
let mut builder = SwarmBuilder::new(transport, behaviour, local_peer_id)
|
||||
let builder = {
|
||||
struct SpawnImpl<F>(F);
|
||||
impl<F: Fn(Pin<Box<dyn Future<Output = ()> + Send>>)> Executor for SpawnImpl<F> {
|
||||
fn exec(&self, f: Pin<Box<dyn Future<Output = ()> + Send>>) {
|
||||
(self.0)(f)
|
||||
}
|
||||
}
|
||||
SwarmBuilder::with_executor(
|
||||
transport,
|
||||
behaviour,
|
||||
local_peer_id,
|
||||
SpawnImpl(params.executor),
|
||||
)
|
||||
};
|
||||
let builder = builder
|
||||
.connection_limits(
|
||||
ConnectionLimits::default()
|
||||
.with_max_established_per_peer(Some(crate::MAX_CONNECTIONS_PER_PEER as u32))
|
||||
@@ -383,14 +397,6 @@ where
|
||||
.connection_event_buffer_size(1024)
|
||||
.max_negotiating_inbound_streams(2048);
|
||||
|
||||
struct SpawnImpl<F>(F);
|
||||
impl<F: Fn(Pin<Box<dyn Future<Output = ()> + Send>>)> Executor for SpawnImpl<F> {
|
||||
fn exec(&self, f: Pin<Box<dyn Future<Output = ()> + Send>>) {
|
||||
(self.0)(f)
|
||||
}
|
||||
}
|
||||
builder = builder.executor(Box::new(SpawnImpl(params.executor)));
|
||||
|
||||
(builder.build(), bandwidth)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user