Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 3c2bd9a

Browse files
authored
Make sure nodes don't hammer each other even when reserved (paritytech#8901)
* Make sure nodes don't hammer each other even when reserved * Make the ban random
1 parent 90cfb95 commit 3c2bd9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/network/src/protocol/notifications/behaviour.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,9 +1851,10 @@ impl NetworkBehaviour for Notifications {
18511851
trace!(target: "sub-libp2p", "PSM <= Dropped({:?})", source);
18521852
self.peerset.dropped(set_id, source.clone(), sc_peerset::DropReason::Refused);
18531853

1854+
let ban_dur = Uniform::new(5, 10).sample(&mut rand::thread_rng());
18541855
*entry.into_mut() = PeerState::Disabled {
18551856
connections,
1856-
backoff_until: None
1857+
backoff_until: Some(Instant::now() + Duration::from_secs(ban_dur))
18571858
};
18581859
} else {
18591860
*entry.into_mut() = PeerState::Enabled { connections };

0 commit comments

Comments
 (0)