Skip to content

Commit 7e25f61

Browse files
committed
fix: busy loop on shutdown
1 parent b109803 commit 7e25f61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/client.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1437,8 +1437,11 @@ where
14371437

14381438
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
14391439
self.inner.maybe_close_connection_if_no_streams();
1440+
let had_streams_or_refs = self.inner.has_streams_or_other_references();
14401441
let result = self.inner.poll(cx).map_err(Into::into);
1441-
if result.is_pending() && !self.inner.has_streams_or_other_references() {
1442+
// if we had streams/refs, and don't anymore, wake up one more time to
1443+
// ensure proper shutdown
1444+
if result.is_pending() && had_streams_or_refs && !self.inner.has_streams_or_other_references() {
14421445
tracing::trace!("last stream closed during poll, wake again");
14431446
cx.waker().wake_by_ref();
14441447
}

0 commit comments

Comments
 (0)