fix broken pipe for h2 when client is instantly dropped

This commit is contained in:
fakeshadow 2021-03-25 21:25:39 +08:00
parent 3188ef5731
commit 79f8480432
1 changed files with 7 additions and 1 deletions

View File

@ -174,8 +174,14 @@ impl H2ConnectionInner {
/// Cancel spawned connection task on drop.
impl Drop for H2ConnectionInner {
fn drop(&mut self) {
if self
.sender
.send_request(http::Request::new(()), true)
.is_err()
{
self.handle.abort();
}
}
}
#[allow(dead_code)]