mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(net): add capacity check on ping (#558)
This commit is contained in:
@ -339,6 +339,10 @@ where
|
|||||||
let id = *bytes.first().ok_or(P2PStreamError::EmptyProtocolMessage)?;
|
let id = *bytes.first().ok_or(P2PStreamError::EmptyProtocolMessage)?;
|
||||||
match id {
|
match id {
|
||||||
_ if id == P2PMessageID::Ping as u8 => {
|
_ if id == P2PMessageID::Ping as u8 => {
|
||||||
|
if this.outgoing_messages.len() > MAX_P2P_CAPACITY {
|
||||||
|
return Poll::Ready(Some(Err(P2PStreamError::SendBufferFull)))
|
||||||
|
}
|
||||||
|
|
||||||
tracing::trace!("Received Ping, Sending Pong");
|
tracing::trace!("Received Ping, Sending Pong");
|
||||||
this.send_pong();
|
this.send_pong();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user