Skip to content

Commit 0e72d23

Browse files
committed
feat(retry): retry on h2 go away with no error
1 parent 4ec6a70 commit 0e72d23

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

client/src/middleware/retry_closed_connection.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,31 @@ where
3939
return Err(Error::Io(err));
4040
}
4141
}
42+
#[cfg(feature = "http1")]
4243
Err(Error::H1(crate::h1::Error::Io(err))) => {
4344
if err.kind() != io::ErrorKind::UnexpectedEof {
4445
return Err(Error::H1(crate::h1::Error::Io(err)));
4546
}
4647
}
48+
#[cfg(feature = "http2")]
49+
Err(Error::H2(crate::h2::Error::H2(err))) => {
50+
if !err.is_go_away() {
51+
return Err(Error::H2(crate::h2::Error::H2(err)));
52+
}
53+
54+
let reason = err.reason().unwrap();
55+
56+
if reason != h2::Reason::NO_ERROR {
57+
return Err(Error::H2(crate::h2::Error::H2(err)));
58+
}
59+
}
60+
#[cfg(feature = "http2")]
4761
Err(Error::H2(crate::h2::Error::Io(err))) => {
4862
if err.kind() != io::ErrorKind::UnexpectedEof {
4963
return Err(Error::H2(crate::h2::Error::Io(err)));
5064
}
5165
}
66+
#[cfg(feature = "http3")]
5267
Err(Error::H3(crate::h3::Error::Io(err))) => {
5368
if err.kind() != io::ErrorKind::UnexpectedEof {
5469
return Err(Error::H3(crate::h3::Error::Io(err)));

0 commit comments

Comments
 (0)