retry all tcp on all IO errors recieved from UDP requests

This commit is contained in:
Benjamin Fry 2024-05-17 19:31:51 -07:00 committed by Dirkjan Ochtman
parent 27018620b7
commit 202c2304da
2 changed files with 7 additions and 1 deletions

View File

@ -381,6 +381,12 @@ impl ProtoError {
matches!(*self.kind, ProtoErrorKind::NoConnections)
}
/// Returns true if this is a std::io::Error
#[inline]
pub fn is_io(&self) -> bool {
matches!(*self.kind, ProtoErrorKind::Io(..))
}
pub(crate) fn as_dyn(&self) -> &(dyn std::error::Error + 'static) {
self
}

View File

@ -264,7 +264,7 @@ where
debug!("truncated response received, retrying over TCP");
Ok(response)
}
Err(e) if opts.try_tcp_on_error || e.is_no_connections() => {
Err(e) if opts.try_tcp_on_error || e.is_no_connections() || e.is_io() => {
debug!("error from UDP, retrying over TCP: {}", e);
Err(e)
}