Skip to content

Commit

Permalink
Await writing preface and initial frame
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed May 10, 2024
1 parent 99addcf commit c627084
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Connection/Internal/Http2ConnectionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ public function isClosed(): bool
private function runReadFiber(): void
{
try {
$this->frameQueue->pushAsync(Http2Parser::PREFACE)->ignore();
$this->frameQueue->push(Http2Parser::PREFACE);

$this->writeFrame(
type: Http2Parser::SETTINGS,
Expand All @@ -1101,7 +1101,7 @@ private function runReadFiber(): void
Http2Parser::MAX_FRAME_SIZE,
self::DEFAULT_MAX_FRAME_SIZE
)
)->ignore();
)->await();
} catch (\Throwable $exception) {
$this->shutdown(new SocketException(
"The HTTP/2 connection closed" . ($this->shutdown !== null ? ' unexpectedly' : ''),
Expand Down Expand Up @@ -1144,10 +1144,7 @@ private function writeFrame(
return Future::complete();
}

// \assert(Http2Parser::logDebugFrame('send', $type, $flags, $stream, \strlen($data)));

return $this->frameQueue->pushAsync(Http2Parser::compileFrame($data, $type, $flags, $stream));
// return $this->frameQueue->pushAsync(\pack("NcN", (\strlen($data) << 8) | ($type & 0xff), $flags, $stream) . $data);
}

private function applySetting(int $setting, int $value): void
Expand Down

0 comments on commit c627084

Please sign in to comment.