small fixes
This commit is contained in:
		
				
					committed by
					
						
						Steffen Schröder
					
				
			
			
				
	
			
			
			
						parent
						
							a85f5b36fb
						
					
				
				
					commit
					6e77606d7e
				
			@@ -113,7 +113,7 @@ class Client
 | 
				
			|||||||
		$this->bigEndianTest();
 | 
							$this->bigEndianTest();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// open connection
 | 
							// open connection
 | 
				
			||||||
		$this->socket = @fsockopen($hostname, $port, $errno, $errstr, $this->timeout/1000);
 | 
							$this->socket = @fsockopen($hostname, $port, $errno, $errstr, $this->timeout * 10000);
 | 
				
			||||||
		if (!$this->socket)
 | 
							if (!$this->socket)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			throw new FatalException("transport error - could not open socket (error: $errno, $errstr)", FatalException::NOT_INITIALIZED);
 | 
								throw new FatalException("transport error - could not open socket (error: $errno, $errstr)", FatalException::NOT_INITIALIZED);
 | 
				
			||||||
@@ -153,7 +153,7 @@ class Client
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		$xml = $request->getXml();
 | 
							$xml = $request->getXml();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		@stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 100);
 | 
							@stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 5);
 | 
				
			||||||
		// send request
 | 
							// send request
 | 
				
			||||||
		$this->reqhandle++;
 | 
							$this->reqhandle++;
 | 
				
			||||||
		if ($this->protocol == 1)
 | 
							if ($this->protocol == 1)
 | 
				
			||||||
@@ -196,7 +196,7 @@ class Client
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			$size = 0;
 | 
								$size = 0;
 | 
				
			||||||
			$recvhandle = 0;
 | 
								$recvhandle = 0;
 | 
				
			||||||
			@stream_set_timeout($this->socket, 0, $this->timeout * 1000);  
 | 
								@stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 2);
 | 
				
			||||||
			// Get result
 | 
								// Get result
 | 
				
			||||||
			if ($this->protocol == 1)
 | 
								if ($this->protocol == 1)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -361,7 +361,7 @@ class Client
 | 
				
			|||||||
		$contents = '';
 | 
							$contents = '';
 | 
				
			||||||
		$contents_length = 0;
 | 
							$contents_length = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		@stream_set_timeout($this->socket, 0, $this->timeout * 1000);  // timeout 10 ms (to read available data)
 | 
							@stream_set_timeout($this->socket, 0, $this->timeout * 100);  // timeout 10 ms (to read available data)
 | 
				
			||||||
		// (assignment in arguments is forbidden since php 5.1.1)
 | 
							// (assignment in arguments is forbidden since php 5.1.1)
 | 
				
			||||||
		$read = array($this->socket);
 | 
							$read = array($this->socket);
 | 
				
			||||||
		$write = NULL;
 | 
							$write = NULL;
 | 
				
			||||||
@@ -370,7 +370,7 @@ class Client
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		try
 | 
							try
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			$nb = @stream_select($read, $write, $except, 0, $this->timeout * 1000);
 | 
								$nb = @stream_select($read, $write, $except, 0, $this->timeout * 100);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		catch (\Exception $e)
 | 
							catch (\Exception $e)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,7 +48,7 @@ class ManiaControl implements CommandListener, TimerListener {
 | 
				
			|||||||
	const API_VERSION                 = '2013-04-16';
 | 
						const API_VERSION                 = '2013-04-16';
 | 
				
			||||||
	const OS_UNIX                     = 'Unix';
 | 
						const OS_UNIX                     = 'Unix';
 | 
				
			||||||
	const OS_WIN                      = 'Windows';
 | 
						const OS_WIN                      = 'Windows';
 | 
				
			||||||
	const CONNECT_TIMEOUT             = 20000;
 | 
						const CONNECT_TIMEOUT             = 50;
 | 
				
			||||||
	const SCRIPT_TIMEOUT              = 20;
 | 
						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';
 | 
				
			||||||
@@ -211,6 +211,7 @@ class ManiaControl implements CommandListener, TimerListener {
 | 
				
			|||||||
		if ($message) {
 | 
							if ($message) {
 | 
				
			||||||
			$this->log($message);
 | 
								$this->log($message);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		exit();
 | 
							exit();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -225,10 +226,14 @@ class ManiaControl implements CommandListener, TimerListener {
 | 
				
			|||||||
		$this->chat->sendInformation('ManiaControl shutting down.');
 | 
							$this->chat->sendInformation('ManiaControl shutting down.');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if($this->client){
 | 
							if($this->client){
 | 
				
			||||||
 | 
								try{
 | 
				
			||||||
			// Hide manialinks
 | 
								// Hide manialinks
 | 
				
			||||||
			$this->client->sendHideManialinkPage();
 | 
								$this->client->sendHideManialinkPage();
 | 
				
			||||||
			// Close the client connection
 | 
								// Close the client connection
 | 
				
			||||||
			$this->client->delete($this->server->ip, $this->server->port);
 | 
								$this->client->delete($this->server->ip, $this->server->port);
 | 
				
			||||||
 | 
								} catch(FatalException $e){
 | 
				
			||||||
 | 
									$this->errorHandler->triggerDebugNotice($e->getMessage() ." File: " . $e->getFile() . " Line: " . $e->getLine());
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Check and Trigger Fatal Errors
 | 
							//Check and Trigger Fatal Errors
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -323,7 +323,7 @@ class Server implements CallbackListener {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		// Server not yet in given status - Wait for it...
 | 
							// Server not yet in given status - Wait for it...
 | 
				
			||||||
		$waitBegin   = time();
 | 
							$waitBegin   = time();
 | 
				
			||||||
		$maxWaitTime = 30;
 | 
							$maxWaitTime = 50;
 | 
				
			||||||
		$lastStatus  = $response->name;
 | 
							$lastStatus  = $response->name;
 | 
				
			||||||
		$this->maniaControl->log("Waiting for server to reach status {$statusCode}...");
 | 
							$this->maniaControl->log("Waiting for server to reach status {$statusCode}...");
 | 
				
			||||||
		$this->maniaControl->log("Current Status: {$lastStatus}");
 | 
							$this->maniaControl->log("Current Status: {$lastStatus}");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user