fix(gossipsub): gracefully disable handler on stream errors

Previously, we closed the entire connection upon receiving too many upgrade errors. This is unnecessarily aggressive. For example, an upgrade error may be caused by the remote dropping a stream during the initial handshake which is completely isolated from other protocols running on the same connection.

Instead of closing the connection, set `KeepAlive::No`.

Related: #3591.
Resolves: #3690.

Pull-Request: #3625.
This commit is contained in:
Victor Ermolaev
2023-04-14 17:19:47 +02:00
committed by GitHub
parent 058c2d85ec
commit 96288b8984
11 changed files with 302 additions and 279 deletions

View File

@ -158,9 +158,12 @@ mod types;
mod rpc_proto;
#[deprecated(note = "This error will no longer be emitted")]
pub type HandlerError = error_priv::HandlerError;
pub use self::behaviour::{Behaviour, Event, MessageAuthenticity};
pub use self::config::{Config, ConfigBuilder, ValidationMode, Version};
pub use self::error_priv::{HandlerError, PublishError, SubscriptionError, ValidationError};
pub use self::error_priv::{PublishError, SubscriptionError, ValidationError};
pub use self::peer_score::{
score_parameter_decay, score_parameter_decay_with_base, PeerScoreParams, PeerScoreThresholds,
TopicScoreParams,