From e07d274e646027092b1ccf27428eed3b2907a149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20Kep=C3=A1k?= Date: Tue, 8 Jun 2021 23:31:10 +0200 Subject: [PATCH] Try to reconnect on socket error (broken pipe mostly) (#50) --- src/Connection/Connection.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Connection/Connection.php b/src/Connection/Connection.php index 9f4610a..47086d8 100644 --- a/src/Connection/Connection.php +++ b/src/Connection/Connection.php @@ -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); }