Skip to content

Commit 65f2afd

Browse files
committed
Add support for the latest PMMP
1 parent c3dbbc0 commit 65f2afd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

ProxyNetworkInterface.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public function getSession(int $socketId): ?NetworkSession
274274
return $this->sessions[$socketId] ?? null;
275275
}
276276

277-
public function putPacket(int $socketId, ProxyPacket $pk): void
277+
public function putPacket(int $socketId, ProxyPacket $pk, int $receiptId = null): void
278278
{
279279
$serializer = new ProxyPacketSerializer();
280280
$serializer->putLInt($socketId);
@@ -289,6 +289,10 @@ public function putPacket(int $socketId, ProxyPacket $pk): void
289289
} catch (Error $exception) {
290290
$this->server->getLogger()->debug('Packet was send while the client was already shut down');
291291
}
292+
293+
if ($receiptId !== null) {
294+
$this->getSession($socketId)?->handleAckReceipt($receiptId);
295+
}
292296
}
293297

294298
public function createSession(int $socketId, string $ip, int $port): NetworkSession

ProxyPacketSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public function __construct(int $socketId, ProxyNetworkInterface $handler)
2626
$this->handler = $handler;
2727
}
2828

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

35-
$this->handler->putPacket($this->socketId, $pk);
35+
$this->handler->putPacket($this->socketId, $pk, $receiptId);
3636
}
3737
}
3838

0 commit comments

Comments
 (0)