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

@ -134,12 +134,6 @@ impl std::fmt::Display for ValidationError {
impl std::error::Error for ValidationError {}
impl From<std::io::Error> for HandlerError {
fn from(error: std::io::Error) -> HandlerError {
HandlerError::Codec(quick_protobuf_codec::Error::from(error))
}
}
impl From<std::io::Error> for PublishError {
fn from(error: std::io::Error) -> PublishError {
PublishError::TransformFailed(error)