improved catching of transport exception on connect
This commit is contained in:
parent
b5715ebe66
commit
61d80b340d
@ -30,7 +30,6 @@ use ManiaControl\Utils\Formatter;
|
|||||||
use ManiaControl\Utils\SystemUtil;
|
use ManiaControl\Utils\SystemUtil;
|
||||||
use Maniaplanet\DedicatedServer\Connection;
|
use Maniaplanet\DedicatedServer\Connection;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\AuthenticationException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\AuthenticationException;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\TransportException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\TransportException;
|
||||||
|
|
||||||
require_once __DIR__ . '/Libs/Maniaplanet/DedicatedServer/Connection.php';
|
require_once __DIR__ . '/Libs/Maniaplanet/DedicatedServer/Connection.php';
|
||||||
@ -302,7 +301,11 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
|||||||
$this->log('Starting ManiaControl v' . self::VERSION . '!');
|
$this->log('Starting ManiaControl v' . self::VERSION . '!');
|
||||||
|
|
||||||
// Connect to server
|
// Connect to server
|
||||||
$this->connect();
|
try {
|
||||||
|
$this->connect();
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
$this->quit($e->getMessage(), true);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the version of the server is high enough
|
// Check if the version of the server is high enough
|
||||||
$version = $this->client->getVersion();
|
$version = $this->client->getVersion();
|
||||||
@ -360,14 +363,8 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
|||||||
$this->client->enableCallbacks(true);
|
$this->client->enableCallbacks(true);
|
||||||
|
|
||||||
// Wait for server to be ready
|
// Wait for server to be ready
|
||||||
try {
|
if (!$this->server->waitForStatus(4)) {
|
||||||
if (!$this->server->waitForStatus(4)) {
|
$this->quit("Server couldn't get ready!");
|
||||||
$this->quit("Server couldn't get ready!");
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// TODO remove
|
|
||||||
$this->errorHandler->handleException($e, false);
|
|
||||||
$this->quit($e->getMessage(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect finished
|
// Connect finished
|
||||||
|
Loading…
Reference in New Issue
Block a user