aboutsummaryrefslogtreecommitdiffstats
path: root/Connection.php
diff options
context:
space:
mode:
Diffstat (limited to 'Connection.php')
-rw-r--r--Connection.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/Connection.php b/Connection.php
index 75899fe..96a70c6 100644
--- a/Connection.php
+++ b/Connection.php
@@ -463,14 +463,20 @@ abstract class Connection
}
}
- $this->close(self::CLOSE_NORMAL);
- $this->getListener()->fire(
- 'close',
- new Event\Bucket([
- 'code' => $code,
- 'reason' => $reason
- ])
- );
+ try {
+ $this->close(self::CLOSE_NORMAL);
+ } catch (HoaException\Idle $e) {
+ // Cannot properly close the connection because the
+ // client might already be disconnected.
+ } finally {
+ $this->getListener()->fire(
+ 'close',
+ new Event\Bucket([
+ 'code' => $code,
+ 'reason' => $reason
+ ])
+ );
+ }
break;