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,7 +174,13 @@ impl H2ConnectionInner {
/// Cancel spawned connection task on drop. /// Cancel spawned connection task on drop.
impl Drop for H2ConnectionInner { impl Drop for H2ConnectionInner {
fn drop(&mut self) { fn drop(&mut self) {
self.handle.abort(); if self
.sender
.send_request(http::Request::new(()), true)
.is_err()
{
self.handle.abort();
}
} }
} }