Skip to content

Commit de61e18

Browse files
author
brentru
committed
fix port issue
1 parent eda5990 commit de61e18

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

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

206+
# pylint: disable=too-many-branches
206207
def _get_connect_socket(self, host, port, *, timeout=1):
207208
"""Obtains a new socket and connects to a broker.
208209
:param str host: Desired broker hostname
@@ -222,6 +223,9 @@ def _get_connect_socket(self, host, port, *, timeout=1):
222223
if self._ssl_context is None:
223224
self._ssl_context = _fake_context
224225

226+
if not isinstance(port, int):
227+
raise RuntimeError("Port must be an integer")
228+
225229
if port == 8883 and not self._ssl_context:
226230
raise RuntimeError(
227231
"ssl_context must be set before using adafruit_mqtt for secure MQTT."

0 commit comments

Comments
 (0)