Skip to content

Commit

Permalink
chance method name to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Feb 4, 2021
1 parent 33441ca commit c9ab6ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def __init__(
self.on_subscribe = None
self.on_unsubscribe = None

def _get_socket(self, host, port, *, timeout=1):
"""Obtains and connects a new socket to a host.
def _get_connect_socket(self, host, port, *, timeout=1):
"""Obtains a new socket and connects to a broker.
:param str host: Desired broker hostname
:param int port: Desired broker port
:param int timeout: Desired socket timeout
Expand All @@ -214,15 +214,15 @@ def _get_socket(self, host, port, *, timeout=1):
self._sock.close()
self._sock = None

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

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

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

# Get a new socket
self._sock = self._get_socket(self.broker, self.port)
self._sock = self._get_connect_socket(self.broker, self.port)

# Fixed Header
fixed_header = bytearray([0x10])
Expand Down

0 comments on commit c9ab6ab

Please sign in to comment.