protocols/ping: Don't force close conn if not supported by remote (#2149)

Don't close connection if ping protocol is unsupported by remote. Previously, a
failed protocol negotation for ping caused a force close of the connection. As a
result, all nodes in a network had to support ping. To allow networks where some
nodes don't support ping, we now emit `PingFailure::Unsupported` once for every
connection on which ping is not supported.

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Thomas Eizinger
2021-07-31 06:21:21 +10:00
committed by GitHub
parent ad90167042
commit 1e001a2e0e
6 changed files with 158 additions and 166 deletions

View File

@ -223,6 +223,12 @@ fn main() -> Result<(), Box<dyn Error>> {
} => {
println!("ping: timeout to {}", peer.to_base58());
}
PingEvent {
peer,
result: Result::Err(PingFailure::Unsupported),
} => {
println!("ping: {} does not support ping protocol", peer.to_base58());
}
PingEvent {
peer,
result: Result::Err(PingFailure::Other { error }),