Don't try to send oversized packets (#10042)
* Don't construct oversized packets * Add test for payload limit * [eth-sync] Fix wrongly computed data sizes * Replace `MAX_RECEIPTS_TO_SEND` with overall softlimit
This commit is contained in:
committed by
Afri Schoedon
parent
b180be7526
commit
e435407080
@@ -288,6 +288,9 @@ pub trait NetworkContext {
|
||||
|
||||
/// Returns whether the given peer ID is a reserved peer.
|
||||
fn is_reserved_peer(&self, peer: PeerId) -> bool;
|
||||
|
||||
/// Returns the size the payload shouldn't exceed
|
||||
fn payload_soft_limit(&self) -> usize;
|
||||
}
|
||||
|
||||
impl<'a, T> NetworkContext for &'a T where T: ?Sized + NetworkContext {
|
||||
@@ -338,6 +341,10 @@ impl<'a, T> NetworkContext for &'a T where T: ?Sized + NetworkContext {
|
||||
fn is_reserved_peer(&self, peer: PeerId) -> bool {
|
||||
(**self).is_reserved_peer(peer)
|
||||
}
|
||||
|
||||
fn payload_soft_limit(&self) -> usize {
|
||||
(**self).payload_soft_limit()
|
||||
}
|
||||
}
|
||||
|
||||
/// Network IO protocol handler. This needs to be implemented for each new subprotocol.
|
||||
|
||||
Reference in New Issue
Block a user