Skip to content

Commit 0173fc3

Browse files
Use endpoint instead od Host in _try_connect
1 parent dd1adc7 commit 0173fc3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cassandra/cluster.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,7 +3545,7 @@ def _connect_host_in_lbp(self):
35453545

35463546
for host in lbp.make_query_plan():
35473547
try:
3548-
return (self._try_connect(host), None)
3548+
return (self._try_connect(host.endpoint), None)
35493549
except ConnectionException as exc:
35503550
errors[str(host.endpoint)] = exc
35513551
log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
@@ -3582,28 +3582,28 @@ def _reconnect_internal(self):
35823582

35833583
raise NoHostAvailable("Unable to connect to any servers", errors)
35843584

3585-
def _try_connect(self, host):
3585+
def _try_connect(self, endpoint):
35863586
"""
35873587
Creates a new Connection, registers for pushed events, and refreshes
35883588
node/token and schema metadata.
35893589
"""
3590-
log.debug("[control connection] Opening new connection to %s", host)
3590+
log.debug("[control connection] Opening new connection to %s", endpoint)
35913591

35923592
while True:
35933593
try:
3594-
connection = self._cluster.connection_factory(host.endpoint, is_control_connection=True)
3594+
connection = self._cluster.connection_factory(endpoint, is_control_connection=True)
35953595
if self._is_shutdown:
35963596
connection.close()
35973597
raise DriverException("Reconnecting during shutdown")
35983598
break
35993599
except ProtocolVersionUnsupported as e:
3600-
self._cluster.protocol_downgrade(host.endpoint, e.startup_version)
3600+
self._cluster.protocol_downgrade(endpoint, e.startup_version)
36013601
except ProtocolException as e:
36023602
# protocol v5 is out of beta in C* >=4.0-beta5 and is now the default driver
36033603
# protocol version. If the protocol version was not explicitly specified,
36043604
# and that the server raises a beta protocol error, we should downgrade.
36053605
if not self._cluster._protocol_version_explicit and e.is_beta_protocol_error:
3606-
self._cluster.protocol_downgrade(host.endpoint, self._cluster.protocol_version)
3606+
self._cluster.protocol_downgrade(endpoint, self._cluster.protocol_version)
36073607
else:
36083608
raise
36093609

0 commit comments

Comments
 (0)