From 82d6467ceea2743780a2d76f329fead7025efa63 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 1 Jun 2018 16:04:23 +0200 Subject: [PATCH] * new configurable: status_timeout --- config.php | 1 + system/libs/pot/OTS_ServerInfo.php | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.php b/config.php index 8dc32e09..002fd3c4 100644 --- a/config.php +++ b/config.php @@ -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, diff --git a/system/libs/pot/OTS_ServerInfo.php b/system/libs/pot/OTS_ServerInfo.php index 2fcd6450..eb153c93 100644 --- a/system/libs/pot/OTS_ServerInfo.php +++ b/system/libs/pot/OTS_ServerInfo.php @@ -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)