mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Improve #2238, do not crash when an invalid/corrupt RCON stop event happens
This commit is contained in:
parent
4299ebebcc
commit
69492474e4
@ -38,7 +38,7 @@ class RCON{
|
|||||||
private $socket;
|
private $socket;
|
||||||
private $password;
|
private $password;
|
||||||
/** @var RCONInstance[] */
|
/** @var RCONInstance[] */
|
||||||
private $workers;
|
private $workers = [];
|
||||||
private $clientsPerThread;
|
private $clientsPerThread;
|
||||||
|
|
||||||
public function __construct(Server $server, $password, $port = 19132, $interface = "0.0.0.0", $threads = 1, $clientsPerThread = 50){
|
public function __construct(Server $server, $password, $port = 19132, $interface = "0.0.0.0", $threads = 1, $clientsPerThread = 50){
|
||||||
@ -56,7 +56,7 @@ class RCON{
|
|||||||
$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
if($this->socket === false or !socket_bind($this->socket, $interface, (int) $port) or !socket_listen($this->socket)){
|
if($this->socket === false or !socket_bind($this->socket, $interface, (int) $port) or !socket_listen($this->socket)){
|
||||||
$this->server->getLogger()->critical("RCON can't be started: " . socket_strerror(socket_last_error()));
|
$this->server->getLogger()->critical("RCON can't be started: " . socket_strerror(socket_last_error()));
|
||||||
|
$this->threads = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket_set_block($this->socket);
|
socket_set_block($this->socket);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user