summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--composer.json2
-rw-r--r--src/Client.php13
2 files changed, 13 insertions, 2 deletions
diff --git a/composer.json b/composer.json
index 5d26e8a..2b7a4fc 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
{
"name": "ch1p/jobd-client",
- "version": "1.1.1",
+ "version": "1.1.2",
"repositories": [
{
"type": "git",
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