Skip to content

Commit

Permalink
Add support for the latest PMMP
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Apr 5, 2024
1 parent fc57fab commit 85b5ee7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion ProxyNetworkInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function getSession(int $socketId): ?NetworkSession
return $this->sessions[$socketId] ?? null;
}

public function putPacket(int $socketId, ProxyPacket $pk): void
public function putPacket(int $socketId, ProxyPacket $pk, int $receiptId = null): void
{
$serializer = new ProxyPacketSerializer();
$serializer->putLInt($socketId);
Expand All @@ -289,6 +289,10 @@ public function putPacket(int $socketId, ProxyPacket $pk): void
} catch (Error $exception) {
$this->server->getLogger()->debug('Packet was send while the client was already shut down');
}

if ($receiptId !== null) { // TODO: check if QUIC supports acks on specific data ;l
$this->getSession($socketId)?->handleAckReceipt($receiptId);
}
}

public function createSession(int $socketId, string $ip, int $port): NetworkSession
Expand Down
4 changes: 2 additions & 2 deletions ProxyPacketSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public function __construct(int $socketId, ProxyNetworkInterface $handler)
$this->handler = $handler;
}

public function send(string $payload, bool $immediate): void
public function send(string $payload, bool $immediate, ?int $receiptId): void
{
if (!$this->closed) {
$pk = new ForwardPacket();
$pk->payload = $payload;

$this->handler->putPacket($this->socketId, $pk);
$this->handler->putPacket($this->socketId, $pk, $receiptId);
}
}

Expand Down

0 comments on commit 85b5ee7

Please sign in to comment.