/** * @param Connection $connection * @return bool */ private function sniffConnection(Connection $connection) { try { $response = $connection->sniff(); } catch (OperationTimeoutException $exception) { return false; } $nodes = $this->parseClusterState($connection->getTransportSchema(), $response); if (count($nodes) === 0) { return false; } $this->connections = array(); foreach ($nodes as $node) { $nodeDetails = array('host' => $node['host'], 'port' => $node['port']); $this->connections[] = $this->connectionFactory->create($nodeDetails); } $this->nextSniff = time() + $this->sniffingInterval; return true; }