add rate limiting to outbound p2p msg sending (#3560)

treat peers as abusive based on incoming msgs, not outgoing msg rates
This commit is contained in:
Antioch Peverell
2021-02-15 13:49:31 +00:00
committed by GitHub
parent 7649d361e4
commit 4ab72902e0
5 changed files with 33 additions and 28 deletions
+2 -2
View File
@@ -240,8 +240,8 @@ impl PeerStats {
height: peer.info.height(),
direction: direction.to_string(),
last_seen: peer.info.last_seen(),
sent_bytes_per_sec: peer.last_min_sent_bytes().unwrap_or(0) / 60,
received_bytes_per_sec: peer.last_min_received_bytes().unwrap_or(0) / 60,
sent_bytes_per_sec: peer.tracker().sent_bytes.read().bytes_per_min() / 60,
received_bytes_per_sec: peer.tracker().received_bytes.read().bytes_per_min() / 60,
capabilities: peer.info.capabilities,
}
}