Skip to content

Commit

Permalink
Provide origin stream id in UpgradedSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Feb 15, 2024
1 parent 91784cf commit e88a602
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Driver/Http2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Http3Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Driver/UpgradedSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}
Expand Down

0 comments on commit e88a602

Please sign in to comment.