* new configurable: status_timeout

This commit is contained in:
slawkens 2018-06-01 16:04:23 +02:00
parent 887c792a76
commit 82d6467cee
2 changed files with 3 additions and 3 deletions

View File

@ -233,6 +233,7 @@ $config = array(
// status, took automatically from config file if empty
'status_ip' => '',
'status_port' => '',
'status_timeout' => 2, // how long to wait for the initial response from the server (default: 2 seconds)
// other
'anonymous_usage_statistics' => true,

View File

@ -50,15 +50,14 @@ class OTS_ServerInfo
/**
* Sends packet to server.
*
* @param OTS_Buffer $packet Buffer to send.
* @param OTS_Buffer|string $packet Buffer to send.
* @return OTS_Buffer|null Respond buffer (null if server is offline).
* @throws E_OTS_OutOfBuffer When there is read attemp after end of packet stream.
*/
private function send(OTS_Buffer $packet)
{
// connects to server
// gives maximum 5 seconds to connect
$socket = @fsockopen($this->server, $this->port, $error, $message, 5);
$socket = @fsockopen($this->server, $this->port, $error, $message, config('status_timeout'));
// if connected then checking statistics
if($socket)