Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Server: Fix throws exceptions while broadcasting messages.
Browse files Browse the repository at this point in the history
While broadcasting a message to some nodes an error can occur because the node connection is closed but isn't yet removed from the *to send* list.
Here we will catch these exceptions to allow the server to continue working.
  • Loading branch information
Metalaka committed Feb 15, 2016
1 parent 91add13 commit 2ece53d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,21 @@ protected function _run(HoaSocket\Node $node)
break;
}

$this->getListener()->fire(
'message',
new Event\Bucket([
'message' => $frame['message']
])
);
try {
$this->getListener()->fire(
'message',
new Event\Bucket([
'message' => $frame['message']
])
);
} catch (HoaException\Group $e) {
$this->getListener()->fire(
'error',
new Event\Bucket([
'exception' => $e
])
);
}

break;
} else {
Expand Down

0 comments on commit 2ece53d

Please sign in to comment.