Skip to content

Commit

Permalink
client supports security
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaileke committed Aug 7, 2024
1 parent ba4c754 commit 9555243
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/protocol/OpenConnectionRequest2.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ class OpenConnectionRequest2 extends OfflineMessage{

public int $cookie = 0;
public int $clientID;
public bool $clientSupportsSecurity = false; // Always false for the vanilla client.
public InternetAddress $serverAddress;
public int $mtuSize;

protected function encodePayload(PacketSerializer $out) : void{
$this->writeMagic($out);
if (Cookie::$serverHasSecurity) {
$out->putInt($this->cookie);
$out->putBool(false); // Client wrote challenge
$out->putBool($this->clientSupportsSecurity);
}
$out->putAddress($this->serverAddress);
$out->putShort($this->mtuSize);
Expand All @@ -42,7 +43,7 @@ protected function decodePayload(PacketSerializer $in) : void{
$this->readMagic($in);
if (Cookie::$serverHasSecurity) {
$this->cookie = $in->getInt();
$in->getBool();
$this->clientSupportsSecurity = $in->getBool();
}
$this->serverAddress = $in->getAddress();
$this->mtuSize = $in->getShort();
Expand Down

0 comments on commit 9555243

Please sign in to comment.