mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +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 $password;
|
||||
/** @var RCONInstance[] */
|
||||
private $workers;
|
||||
private $workers = [];
|
||||
private $clientsPerThread;
|
||||
|
||||
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);
|
||||
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->threads = 0;
|
||||
return;
|
||||
}
|
||||
socket_set_block($this->socket);
|
||||
|
Loading…
x
Reference in New Issue
Block a user