Don't change rep on timeout in collator protocol. (#4642)

* Don't change rep on timeout in collator protocol.

* Fix tests.

* Fixes.
This commit is contained in:
Robert Klotzner
2022-01-04 12:40:20 +01:00
committed by GitHub
parent 712b53f468
commit 83c8afcbb9
3 changed files with 37 additions and 70 deletions
@@ -94,6 +94,20 @@ pub enum RequestError {
Canceled(#[source] oneshot::Canceled),
}
impl RequestError {
/// Whether the error represents some kind of timeout condition.
pub fn is_timed_out(&self) -> bool {
match self {
Self::Canceled(_) |
Self::NetworkError(network::RequestFailure::Obsolete) |
Self::NetworkError(network::RequestFailure::Network(
network::OutboundFailure::Timeout,
)) => true,
_ => false,
}
}
}
/// A request to be sent to the network bridge, including a sender for sending responses/failures.
///
/// The network implementation will make use of that sender for informing the requesting subsystem