Skip to content

Commit

Permalink
Merge pull request #2251 from subspace/move-connection-limits
Browse files Browse the repository at this point in the history
Move connection limits to work around bug in libp2p
  • Loading branch information
nazar-pc authored Nov 20, 2023
2 parents 7d622bf + 7c981a7 commit 86a3084
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/subspace-networking/src/behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ pub(crate) struct SpecialConnectedPeersInstance;
#[behaviour(to_swarm = "Event")]
#[behaviour(event_process = false)]
pub(crate) struct Behavior<RecordStore> {
// TODO: Connection limits must be the first protocol due to https://github.com/libp2p/rust-libp2p/issues/4773 as
// suggested in https://github.com/libp2p/rust-libp2p/issues/4898#issuecomment-1818013483
pub(crate) connection_limits: ConnectionLimitsBehaviour,
pub(crate) identify: Identify,
pub(crate) kademlia: Kademlia<RecordStore>,
pub(crate) gossipsub: Toggle<Gossipsub>,
pub(crate) ping: Ping,
pub(crate) request_response: RequestResponseFactoryBehaviour,
pub(crate) connection_limits: ConnectionLimitsBehaviour,
pub(crate) block_list: BlockListBehaviour,
pub(crate) reserved_peers: ReservedPeersBehaviour,
pub(crate) peer_info: Toggle<PeerInfoBehaviour>,
Expand Down Expand Up @@ -119,6 +121,7 @@ where
.map(|provider| PeerInfoBehaviour::new(config.peer_info_config, provider));

Self {
connection_limits: ConnectionLimitsBehaviour::new(config.connection_limits),
identify: Identify::new(config.identify),
kademlia,
gossipsub,
Expand All @@ -128,7 +131,6 @@ where
)
//TODO: Convert to an error.
.expect("RequestResponse protocols registration failed."),
connection_limits: ConnectionLimitsBehaviour::new(config.connection_limits),
block_list: BlockListBehaviour::default(),
reserved_peers: ReservedPeersBehaviour::new(config.reserved_peers),
peer_info: peer_info.into(),
Expand Down

0 comments on commit 86a3084

Please sign in to comment.