mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-23 16:11:19 +00:00
fix(ping): remove debug_assert on protocol negotiation timeout
The negotiation of the ping protocol can timeout, thus a debug_assert is not correct. Return an `std::io::Error` instead. Pull-Request: #3995.
This commit is contained in:
parent
a8a00e7ad7
commit
efb117e236
@ -196,10 +196,12 @@ impl Handler {
|
||||
return;
|
||||
}
|
||||
// Note: This timeout only covers protocol negotiation.
|
||||
StreamUpgradeError::Timeout => {
|
||||
debug_assert!(false, "ReadyUpgrade cannot time out");
|
||||
return;
|
||||
}
|
||||
StreamUpgradeError::Timeout => Failure::Other {
|
||||
error: Box::new(std::io::Error::new(
|
||||
std::io::ErrorKind::TimedOut,
|
||||
"ping protocol negotiation timed out",
|
||||
)),
|
||||
},
|
||||
StreamUpgradeError::Apply(e) => void::unreachable(e),
|
||||
StreamUpgradeError::Io(e) => Failure::Other { error: Box::new(e) },
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user