From e88a602d7cecca7646b7b32371d7488c0bc193ed Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Fri, 16 Feb 2024 00:25:00 +0100 Subject: [PATCH] Provide origin stream id in UpgradedSocket --- src/Driver/Http2Driver.php | 2 +- src/Driver/Http3Driver.php | 2 +- src/Driver/UpgradedSocket.php | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Driver/Http2Driver.php b/src/Driver/Http2Driver.php index bd676365..0e00e522 100644 --- a/src/Driver/Http2Driver.php +++ b/src/Driver/Http2Driver.php @@ -1169,7 +1169,7 @@ private function upgrade(Request $request, Response $response, int $id): void // The output of an upgraded connection is just DATA frames $outputPipe = new Pipe(0); - $upgraded = new UpgradedSocket($client, $inputStream, $outputPipe->getSink()); + $upgraded = new UpgradedSocket($client, $inputStream, $outputPipe->getSink(), $id); try { $upgradeHandler($upgraded, $request, $response); diff --git a/src/Driver/Http3Driver.php b/src/Driver/Http3Driver.php index 68605366..01add804 100644 --- a/src/Driver/Http3Driver.php +++ b/src/Driver/Http3Driver.php @@ -220,7 +220,7 @@ private function upgrade(QuicSocket $stream, Request $request, Response $respons $settings = $this->parsedSettings->getFuture()->await(); $datagramStream = empty($settings[Http3Settings::H3_DATAGRAM->value]) ? null : new Http3DatagramStream($this->parser->receiveDatagram(...), $this->writer->writeDatagram(...), $this->writer->maxDatagramSize(...), $stream); - $upgraded = new UpgradedSocket($client, $inputStream, $outputPipe->getSink(), $datagramStream); + $upgraded = new UpgradedSocket($client, $inputStream, $outputPipe->getSink(), $stream->getId(), $datagramStream); try { $upgradeHandler($upgraded, $request, $response); diff --git a/src/Driver/UpgradedSocket.php b/src/Driver/UpgradedSocket.php index 90abc4a9..167531c1 100644 --- a/src/Driver/UpgradedSocket.php +++ b/src/Driver/UpgradedSocket.php @@ -27,6 +27,7 @@ public function __construct( private readonly Client $client, private readonly ReadableStream $readableStream, private readonly WritableStream $writableStream, + public readonly int $id = 0, public readonly ?DatagramStream $datagramClient = null, ) { }