Skip to content

Commit

Permalink
Add connection count assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Mar 4, 2020
1 parent 485d44b commit aed9d14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Connection/ConnectionLimitingPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ private function getStreamFor(string $uri, Request $request, CancellationToken $

if ($stream === null) {
$connectionId = \spl_object_id($connection);

\assert(
!isset($this->activeRequestCounts[$connectionId])
|| $this->activeRequestCounts[$connectionId] >= 0
);

if (!$this->isAdditionalConnectionAllowed($uri)
&& ($this->activeRequestCounts[$connectionId] ?? 0) === 0
) {
Expand Down

0 comments on commit aed9d14

Please sign in to comment.