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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect in case we are connected to a Livestatus socket
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
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);
|
||||
Benchmark::measure('...socket closed');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
|
|
Loading…
Reference in New Issue