fix(http2): send a GOAWAY when the user's Service::poll_ready errors

The `Error::source()` is searched for an `h2::Error` to allow sending
different error codes in the GOAWAY. If none is found, it defaults to
`INTERNAL_ERROR`.
This commit is contained in:
Sean McArthur
2019-04-09 12:49:43 -07:00
parent c7a046c518
commit 42c5efc085
3 changed files with 111 additions and 35 deletions

View File

@@ -555,7 +555,6 @@ where
match polled {
Ok(x) => return Ok(x),
Err(e) => {
debug!("error polling connection protocol without shutdown: {}", e);
match *e.kind() {
Kind::Parse(Parse::VersionH2) if self.fallback.to_h2() => {
self.upgrade_h2();
@@ -644,7 +643,6 @@ where
}
})),
Err(e) => {
debug!("error polling connection protocol: {}", e);
match *e.kind() {
Kind::Parse(Parse::VersionH2) if self.fallback.to_h2() => {
self.upgrade_h2();
@@ -962,7 +960,6 @@ mod upgrades {
return Ok(Async::Ready(()));
},
Err(e) => {
debug!("error polling connection protocol: {}", e);
match *e.kind() {
Kind::Parse(Parse::VersionH2) if self.inner.fallback.to_h2() => {
self.inner.upgrade_h2();