Skip to content

Commit c9ab6ab

Browse files
author
brentru
committed
chance method name to be more descriptive
1 parent 33441ca commit c9ab6ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ def __init__(
203203
self.on_subscribe = None
204204
self.on_unsubscribe = None
205205

206-
def _get_socket(self, host, port, *, timeout=1):
207-
"""Obtains and connects a new socket to a host.
206+
def _get_connect_socket(self, host, port, *, timeout=1):
207+
"""Obtains a new socket and connects to a broker.
208208
:param str host: Desired broker hostname
209209
:param int port: Desired broker port
210210
:param int timeout: Desired socket timeout
@@ -214,15 +214,15 @@ def _get_socket(self, host, port, *, timeout=1):
214214
self._sock.close()
215215
self._sock = None
216216

217-
# Legacy API - use a default socket instead of socket pool
217+
# Legacy API - use the interface's socket instead of a passed socket pool
218218
if self._socket_pool is None:
219219
self._socket_pool = _default_sock
220220

221221
# Legacy API - fake the ssl context
222222
if self._ssl_context is None:
223223
self._ssl_context = _fake_context
224224

225-
if port == 8883 and self._ssl_context is None:
225+
if port == 8883 and not self._ssl_context:
226226
raise RuntimeError(
227227
"ssl_context must be set before using adafruit_mqtt for secure MQTT."
228228
)
@@ -425,7 +425,7 @@ def connect(self, clean_session=True, host=None, port=None, keep_alive=None):
425425
self.logger.debug("Attempting to establish MQTT connection...")
426426

427427
# Get a new socket
428-
self._sock = self._get_socket(self.broker, self.port)
428+
self._sock = self._get_connect_socket(self.broker, self.port)
429429

430430
# Fixed Header
431431
fixed_header = bytearray([0x10])

0 commit comments

Comments
 (0)