mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
Livestatus\Connection: check resource on disconnect
This commit is contained in:
parent
2c7373f385
commit
d368df8211
@ -407,11 +407,21 @@ if ($col > $size - 1) return $res;
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect in case we are connected to a Livestatus socket
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
public function disconnect()
|
public function disconnect()
|
||||||
{
|
{
|
||||||
if ($this->connection) {
|
if (is_resource($this->connection)
|
||||||
|
&& get_resource_type($this->connection) === 'Socket')
|
||||||
|
{
|
||||||
|
Benchmark::measure('Disconnecting livestatus...');
|
||||||
socket_close($this->connection);
|
socket_close($this->connection);
|
||||||
|
Benchmark::measure('...socket closed');
|
||||||
}
|
}
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user