Updated RakLib to get ITC efficiency enhancements

This commit is contained in:
Dylan K. Taylor 2019-02-15 12:29:16 +00:00
parent 19f0d7f336
commit 01255c5368
2 changed files with 19 additions and 19 deletions

8
composer.lock generated
View File

@ -413,12 +413,12 @@
"source": {
"type": "git",
"url": "https://github.com/pmmp/RakLib.git",
"reference": "44ebbd68eeb25c07f1d4c1d1af1f7abd5904b76c"
"reference": "2d19bbaa4fb92d9eabe8c027ea0af9dbd6a90100"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/44ebbd68eeb25c07f1d4c1d1af1f7abd5904b76c",
"reference": "44ebbd68eeb25c07f1d4c1d1af1f7abd5904b76c",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/2d19bbaa4fb92d9eabe8c027ea0af9dbd6a90100",
"reference": "2d19bbaa4fb92d9eabe8c027ea0af9dbd6a90100",
"shasum": ""
},
"require": {
@ -446,7 +446,7 @@
"source": "https://github.com/pmmp/RakLib/tree/master",
"issues": "https://github.com/pmmp/RakLib/issues"
},
"time": "2019-01-26T16:51:18+00:00"
"time": "2019-02-15T12:21:28+00:00"
},
{
"name": "pocketmine/snooze",

View File

@ -68,7 +68,7 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
/** @var NetworkSession[] */
private $sessions = [];
/** @var string[] */
/** @var int[] */
private $identifiers = [];
/** @var ServerHandler */
@ -118,11 +118,11 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
}
}
public function closeSession(string $identifier, string $reason) : void{
if(isset($this->sessions[$identifier])){
$session = $this->sessions[$identifier];
public function closeSession(int $sessionId, string $reason) : void{
if(isset($this->sessions[$sessionId])){
$session = $this->sessions[$sessionId];
unset($this->identifiers[spl_object_id($session)]);
unset($this->sessions[$identifier]);
unset($this->sessions[$sessionId]);
$session->onClientDisconnect($reason);
}
}
@ -140,19 +140,19 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
$this->interface->shutdown();
}
public function openSession(string $identifier, string $address, int $port, int $clientID) : void{
public function openSession(int $sessionId, string $address, int $port, int $clientID) : void{
$session = new NetworkSession($this->server, $this, $address, $port);
$this->sessions[$identifier] = $session;
$this->identifiers[spl_object_id($session)] = $identifier;
$this->sessions[$sessionId] = $session;
$this->identifiers[spl_object_id($session)] = $sessionId;
}
public function handleEncapsulated(string $identifier, EncapsulatedPacket $packet, int $flags) : void{
if(isset($this->sessions[$identifier])){
public function handleEncapsulated(int $sessionId, EncapsulatedPacket $packet, int $flags) : void{
if(isset($this->sessions[$sessionId])){
if($packet->buffer === "" or $packet->buffer{0} !== self::MCPE_RAKNET_PACKET_ID){
return;
}
//get this now for blocking in case the player was closed before the exception was raised
$session = $this->sessions[$identifier];
$session = $this->sessions[$sessionId];
$address = $session->getIp();
$port = $session->getPort();
$buf = substr($packet->buffer, 1);
@ -193,7 +193,7 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
$this->interface->addRawPacketFilter($regex);
}
public function notifyACK(string $identifier, int $identifierACK) : void{
public function notifyACK(int $sessionId, int $identifierACK) : void{
}
@ -239,9 +239,9 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
}
}
public function updatePing(string $identifier, int $pingMS) : void{
if(isset($this->sessions[$identifier])){
$this->sessions[$identifier]->updatePing($pingMS);
public function updatePing(int $sessionId, int $pingMS) : void{
if(isset($this->sessions[$sessionId])){
$this->sessions[$sessionId]->updatePing($pingMS);
}
}
}