diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-03-02 03:27:19 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-03-02 03:27:19 +0300 |
commit | c269f18cc8d77a939b74a4abaf886d5d423ff329 (patch) | |
tree | 0e2b80b56d3275fc981c89906f0c66107a67a1ff /src | |
parent | 66cfd0aa35d298378ed3303dde44be66622de7fe (diff) |
Client: close() on destruct
Diffstat (limited to 'src')
-rw-r--r-- | src/Client.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Client.php b/src/Client.php index ec3af88..7146f5a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -39,6 +39,13 @@ class Client { } /** + * JobdClient destructor. + */ + public function __destruct() { + $this->close(); + } + + /** * @return ResponseMessage * @throws \Exception */ @@ -331,7 +338,11 @@ class Client { * @return bool */ public function close() { - return fclose($this->sock); + if (!$this->sock) + return; + + fclose($this->sock); + $this->sock = null; } }
\ No newline at end of file |