Skip to content

Commit

Permalink
Try to reconnect on socket error (broken pipe mostly) (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Radovan Kepák authored Jun 8, 2021
1 parent c4bbc5f commit e07d274
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Connection/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ public function getChannel(): Channel

$this->channel = $channel;
} catch (ClientException $e) {
if ($e->getMessage() !== 'Broken pipe or closed connection.') {
if (!in_array(
$e->getMessage(),
['Broken pipe or closed connection.', 'Could not write data to socket.'],
true
)) {
throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
}

Expand Down

0 comments on commit e07d274

Please sign in to comment.