Skip to content

Commit d0d5f33

Browse files
committed
fix critical bug for WS connectors implement WSConnectorAbstract.php
1 parent 8958cf5 commit d0d5f33

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Connectors/WebSocket/WSConnectorAbstract.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ public function orderNodesByTimeout($orderNodesByTimeout)
132132
}
133133
$timeout = $requestTimeout = microtime(true) - $startMTime;
134134

135-
$connection->close();
135+
if ($connection->isConnected()) {
136+
$connection->close();
137+
}
136138
$timeouts[$currentNodeURL] = round($timeout, 4);
137139
} catch (ConnectionException $e) {
138140
}
@@ -200,7 +202,9 @@ protected function setReserveNodeUrlToCurrentUrl()
200202
public function connectToReserveNode()
201203
{
202204
$connection = $this->getConnection();
203-
$connection->close();
205+
if ($connection->isConnected()) {
206+
$connection->close();
207+
}
204208
$this->setReserveNodeUrlToCurrentUrl();
205209
return $this->newConnection($this->getCurrentUrl());
206210
}

0 commit comments

Comments
 (0)