Skip to content

Commit

Permalink
Update Client.php
Browse files Browse the repository at this point in the history
If RabbitMQ closed the connection due to incorrect login/password
  • Loading branch information
viras777 authored Nov 21, 2021
1 parent e9f2ab5 commit 2751d4f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Bunny/Async/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,16 @@ public function addAwaitCallback(callable $callback)
*/
public function onDataAvailable()
{
$this->read();
try {
$this->read();
} catch (\Throwable $e) {
foreach ($this->awaitCallbacks as $k => $callback) {
if ($callback($e) === true) {
unset($this->awaitCallbacks[$k]);
break;
}
}
}

while (($frame = $this->reader->consumeFrame($this->readBuffer)) !== null) {
foreach ($this->awaitCallbacks as $k => $callback) {
Expand Down

0 comments on commit 2751d4f

Please sign in to comment.