[BUG] Fail in service monitoring for IPv6 #881

This commit is contained in:
Flávio Gomes da Silva Lisboa 2020-03-25 09:30:45 -03:00
parent ee16078884
commit 4944d61839
1 changed files with 5 additions and 1 deletions

View File

@ -225,7 +225,11 @@ class StatusUpdater
// save response time
$starttime = microtime(true);
$fp = @fsockopen($this->server['ip'], $this->server['port'], $errno, $this->error, $timeout);
$serverIp = $this->server['ip'];
if (filter_var($serverIp,FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false){
$serverIp = "[$serverIp]";
}
$fp = @fsockopen($serverIp, $this->server['port'], $errno, $this->error, $timeout);
$status = ($fp === false) ? false : true;
$this->rtime = (microtime(true) - $starttime);