mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Micro-optimizations
This commit is contained in:
@ -59,12 +59,12 @@ class RCON{
|
||||
|
||||
return;
|
||||
}
|
||||
@socket_set_block($this->socket);
|
||||
socket_set_block($this->socket);
|
||||
|
||||
for($n = 0; $n < $this->threads; ++$n){
|
||||
$this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
|
||||
}
|
||||
@socket_getsockname($this->socket, $addr, $port);
|
||||
socket_getsockname($this->socket, $addr, $port);
|
||||
$this->server->getLogger()->info("RCON running on $addr:$port");
|
||||
$this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "check"]), 3);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class RCONInstance extends \Thread{
|
||||
}
|
||||
|
||||
private function readPacket($client, &$size, &$requestID, &$packetType, &$payload){
|
||||
@socket_set_nonblock($client);
|
||||
socket_set_nonblock($client);
|
||||
$d = socket_read($client, 4);
|
||||
if($this->stop === true){
|
||||
return false;
|
||||
@ -66,7 +66,7 @@ class RCONInstance extends \Thread{
|
||||
}elseif($d === "" or strlen($d) < 4){
|
||||
return false;
|
||||
}
|
||||
@socket_set_block($client);
|
||||
socket_set_block($client);
|
||||
$size = Binary::readLInt($d);
|
||||
if($size < 0 or $size > 65535){
|
||||
return false;
|
||||
@ -131,7 +131,7 @@ class RCONInstance extends \Thread{
|
||||
continue;
|
||||
}
|
||||
if($payload === $this->password){
|
||||
@socket_getpeername($client, $addr, $port);
|
||||
socket_getpeername($client, $addr, $port);
|
||||
$this->response = "[INFO] Successful Rcon connection from: /$addr:$port";
|
||||
$this->synchronized(function (){
|
||||
$this->wait();
|
||||
|
Reference in New Issue
Block a user