Skip to content

Commit

Permalink
Remove unnecessary checks for request on stream
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski authored and kelunik committed Oct 8, 2019
1 parent c30989e commit 46442bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Connection/Http2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -919,9 +919,8 @@ private function parser(): \Generator
$error = \unpack("N", $buffer)[1];

if (isset($this->streams[$id])) {
$stream = $this->streams[$id];
$exception = new Http2StreamException("Stream closed by server", $id, $error);
if ($error === self::REFUSED_STREAM && $stream->request !== null) {
if ($error === self::REFUSED_STREAM) {
$exception = new UnprocessedRequestException($exception);
}
$this->releaseStream($id, $exception);
Expand Down Expand Up @@ -1463,7 +1462,7 @@ private function shutdown(?int $lastId = null, ?\Throwable $reason = null): Prom
$reason = $exception = $reason ?? new SocketException("Connection closed");
foreach ($this->streams as $id => $stream) {
$exception = $reason;
if ($id > $lastId && $stream->request !== null) {
if ($id > $lastId) {
$exception = new UnprocessedRequestException($reason);
}

Expand Down

0 comments on commit 46442bc

Please sign in to comment.