net: Mark peer as rejected if we have missing dispatchers for certain packets.

This commit is contained in:
parazyd
2023-09-22 12:57:58 +02:00
parent 59f95dd0fb
commit ee47552eee

View File

@@ -293,6 +293,16 @@ impl Channel {
// If we're getting messages without dispatchers, it's spam.
Err(Error::MissingDispatcher) => {
debug!(target: "net::channel::main_receive_loop()", "Stopping channel {:?}", self);
// We will reject further connections from this peer
self.session
.upgrade()
.unwrap()
.p2p()
.hosts()
.mark_rejected(self.address())
.await;
return Err(Error::ChannelStopped)
}
Err(_) => unreachable!("You added a new error in notify()"),