Client: close() on destruct
This commit is contained in:
parent
66cfd0aa35
commit
c269f18cc8
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ch1p/jobd-client",
|
"name": "ch1p/jobd-client",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -38,6 +38,13 @@ class Client {
|
|||||||
$this->lastOutgoingRequestNo = mt_rand(1, self::REQUEST_NO_LIMIT);
|
$this->lastOutgoingRequestNo = mt_rand(1, self::REQUEST_NO_LIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JobdClient destructor.
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
$this->close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResponseMessage
|
* @return ResponseMessage
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@ -331,7 +338,11 @@ class Client {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function close() {
|
public function close() {
|
||||||
return fclose($this->sock);
|
if (!$this->sock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fclose($this->sock);
|
||||||
|
$this->sock = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user