Skip to content

Commit

Permalink
updated unconnected message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaileke committed Jul 29, 2024
1 parent 80e89f0 commit c58e264
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/UnconnectedMessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ private function handle(OfflineMessage $packet, InternetAddress $address) : bool
$this->server->sendPacket(IncompatibleProtocolVersion::create($this->protocolAcceptor->getPrimaryVersion(), $this->server->getID()), $address);
$this->server->getLogger()->notice("Refused connection from $address due to incompatible RakNet protocol version (version $packet->protocol)");
}else{
$serverHasSecurity = false; // then relocate it ve make it available
$cookie = 0;
if ($serverHasSecurity) {

Check failure on line 86 in src/server/UnconnectedMessageHandler.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

If condition is always false.
$cookie = crc32(Binary::writeLInt(mt_rand(0, 0xFFFFFFFF)) . Binary::writeLShort($address->getPort()) . $address->getIp());

Check failure on line 87 in src/server/UnconnectedMessageHandler.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Call to static method writeLInt() on an unknown class raklib\server\Binary.

Check failure on line 87 in src/server/UnconnectedMessageHandler.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Call to static method writeLShort() on an unknown class raklib\server\Binary.
}
//IP header size (20 bytes) + UDP header size (8 bytes)
$this->server->sendPacket(OpenConnectionReply1::create($this->server->getID(), false, $packet->mtuSize + 28), $address);
$this->server->sendPacket(OpenConnectionReply1::create($this->server->getID(), $serverHasSecurity, $cookie, $packet->mtuSize + 28), $address);
}
}elseif($packet instanceof OpenConnectionRequest2){
if($packet->serverAddress->getPort() === $this->server->getPort() or !$this->server->portChecking){
Expand Down

0 comments on commit c58e264

Please sign in to comment.