Clear recv buffer when stream refs are dropped

This commit is contained in:
Sean McArthur
2019-06-04 16:55:13 -07:00
parent a5a2ee7f7a
commit 611e1ca010
3 changed files with 30 additions and 0 deletions

View File

@@ -448,6 +448,17 @@ impl fmt::Debug for RecvStream {
}
}
impl Drop for RecvStream {
fn drop(&mut self) {
// Eagerly clear any received DATA frames now, since its no longer
// possible to retrieve them. However, this will be called
// again once *all* stream refs have been dropped, since
// this won't send a RST_STREAM frame, in case the user wishes to
// still *send* DATA.
self.inner.inner.clear_recv_buffer();
}
}
// ===== impl ReleaseCapacity =====
impl ReleaseCapacity {