Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Update Session.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Muqsit committed Jul 9, 2016
1 parent dc86dfa commit b4fd3dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/raklib/server/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Session{
private $address;
private $port;
private $state = self::STATE_UNCONNECTED;
private $mtuSize = 548; //Min size
private $mtuSize = 508; //(Max IP Header Size) — (UDP Header Size) = 576 — 60 — 8 = 508
private $id = 0;
private $splitID = 0;

Expand Down Expand Up @@ -518,8 +518,8 @@ public function handlePacket(Packet $packet){
}elseif($this->state === self::STATE_CONNECTING_1 and $packet instanceof OPEN_CONNECTION_REQUEST_2){
$this->id = $packet->clientID;
if($packet->serverPort === $this->sessionManager->getPort() or !$this->sessionManager->portChecking){
$this->mtuSize = min(abs($packet->mtuSize), 1464); //Max size, do not allow creating large buffers to fill server memory
$pk = new OPEN_CONNECTION_REPLY_2();
$this->mtuSize = min(abs($packet->mtuSize), 1432); //MTU — (Max IP Header Size) — (UDP Header Size) = 1500 — 60 — 8 = 1432
$pk = new OPEN_CONNECTION_REPLY_2();
$pk->mtuSize = $this->mtuSize;
$pk->serverID = $this->sessionManager->getID();
$pk->clientAddress = $this->address;
Expand All @@ -536,4 +536,4 @@ public function close(){
$this->addEncapsulatedToQueue(EncapsulatedPacket::fromBinary($data), RakLib::PRIORITY_IMMEDIATE); //CLIENT_DISCONNECT packet 0x15
$this->sessionManager = null;
}
}
}

0 comments on commit b4fd3dd

Please sign in to comment.