Skip to content

Commit

Permalink
Wait until all streams closed
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Nov 28, 2024
1 parent 4e391ab commit fa8f729
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Connection/Internal/Http2ConnectionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1382,12 +1382,15 @@ private function releaseStream(int $streamId, ?\Throwable $exception, bool $unpr
}
}

if ($this->shutdown !== null && $streamId === $this->lastStream) {
$this->socket->close();
}
if (!$this->streams) {
if ($this->shutdown !== null) {
$this->socket->close();
return;
}

if (!$this->streams && !$this->socket->isClosed() && $this->socket instanceof ResourceStream) {
$this->socket->unreference();
if ($this->socket instanceof ResourceStream) {
$this->socket->unreference();
}
}
}

Expand Down

0 comments on commit fa8f729

Please sign in to comment.