reduced connect timeout

This commit is contained in:
Steffen Schröder 2014-05-09 16:33:33 +02:00
parent 991b9048ba
commit 2b3e9113b4

View File

@ -44,13 +44,12 @@ class ManiaControl implements CommandListener, TimerListener {
/* /*
* Constants * Constants
*/ */
const VERSION = 0.14; const VERSION = '0.14';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2014-04-02_18_00'; const MIN_DEDIVERSION = '2014-04-02_18_00';
const OS_UNIX = 'Unix'; const OS_UNIX = 'Unix';
const OS_WIN = 'Windows'; const OS_WIN = 'Windows';
const CONNECT_TIMEOUT = 50; const SCRIPT_TIMEOUT = 10;
const SCRIPT_TIMEOUT = 20;
const URL_WEBSERVICE = 'http://ws.maniacontrol.com/'; const URL_WEBSERVICE = 'http://ws.maniacontrol.com/';
const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl'; const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl';
const SETTING_PERMISSION_RESTART = 'Restart ManiaControl'; const SETTING_PERMISSION_RESTART = 'Restart ManiaControl';
@ -379,7 +378,7 @@ class ManiaControl implements CommandListener, TimerListener {
$this->log("Connecting to server at {$this->server->config->host}:{$this->server->config->port}..."); $this->log("Connecting to server at {$this->server->config->host}:{$this->server->config->port}...");
try { try {
$this->client = Connection::factory($this->server->config->host, $this->server->config->port, self::CONNECT_TIMEOUT, $this->server->config->login, $this->server->config->pass); $this->client = Connection::factory($this->server->config->host, $this->server->config->port, self::SCRIPT_TIMEOUT, $this->server->config->login, $this->server->config->pass);
} catch (Exception $e) { } catch (Exception $e) {
$message = "Couldn't authenticate on Server with User '{$this->server->config->login}' & Pass '{$this->server->config->pass}'! " . $e->getMessage(); $message = "Couldn't authenticate on Server with User '{$this->server->config->login}' & Pass '{$this->server->config->pass}'! " . $e->getMessage();
$this->quit($message, true); $this->quit($message, true);
@ -415,7 +414,7 @@ class ManiaControl implements CommandListener, TimerListener {
private function loop() { private function loop() {
$loopStart = microtime(true); $loopStart = microtime(true);
// Disable script timeout // Extend script timeout
set_time_limit(self::SCRIPT_TIMEOUT); set_time_limit(self::SCRIPT_TIMEOUT);
try { try {