NRPE Protocol: shorter timeout, fail-safe disconnect
This commit is contained in:
parent
b1ba67bca9
commit
b6e7d5c4c1
|
@ -69,11 +69,11 @@ class Connection
|
||||||
} else {
|
} else {
|
||||||
$uri = sprintf('tcp://%s:%d', $this->host, $this->port);
|
$uri = sprintf('tcp://%s:%d', $this->host, $this->port);
|
||||||
}
|
}
|
||||||
$this->connection = stream_socket_client(
|
$this->connection = @stream_socket_client(
|
||||||
$uri,
|
$uri,
|
||||||
$errno,
|
$errno,
|
||||||
$errstr,
|
$errstr,
|
||||||
60,
|
10,
|
||||||
STREAM_CLIENT_CONNECT,
|
STREAM_CLIENT_CONNECT,
|
||||||
$ctx
|
$ctx
|
||||||
);
|
);
|
||||||
|
@ -92,7 +92,7 @@ class Connection
|
||||||
|
|
||||||
protected function disconnect()
|
protected function disconnect()
|
||||||
{
|
{
|
||||||
if ($this->connection !== null) {
|
if (is_resource($this->connection)) {
|
||||||
fclose($this->connection);
|
fclose($this->connection);
|
||||||
$this->connection = null;
|
$this->connection = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue