Skip to content

Commit 4af0ad0

Browse files
author
brentru
committed
socket exists, but ssl.SSLWantReadError persists?
1 parent 1d78c0f commit 4af0ad0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,9 @@ def __init__(
145145
ssl_context=None
146146
):
147147
# Socket Pool
148-
if socket_pool is not None:
148+
if socket_pool:
149149
self._socket_pool = socket_pool
150-
if ssl_context is not None:
151-
self._ssl_context = ssl_context
150+
self._ssl_context = ssl_context
152151
# Hang onto open sockets so that we can reuse them
153152
self._socket_free = {}
154153
self._open_sockets = {}
@@ -165,19 +164,19 @@ def __init__(
165164
self._username = username
166165
self._password = password
167166
if (
168-
self._password is not None
167+
self._password
169168
and len(password.encode("utf-8")) > MQTT_TOPIC_LENGTH_LIMIT
170169
): # [MQTT-3.1.3.5]
171170
raise MMQTTException("Password length is too large.")
172171

173172
self.port = MQTT_TCP_PORT
174173
if is_ssl:
175174
self.port = MQTT_TLS_PORT
176-
if port is not None:
175+
if port:
177176
self.port = port
178177

179178
# define client identifer
180-
if client_id is not None:
179+
if client_id:
181180
# user-defined client_id MAY allow client_id's > 23 bytes or
182181
# non-alpha-numeric characters
183182
self.client_id = client_id
@@ -252,7 +251,6 @@ def _get_socket(self, host, port, *, timeout=1):
252251
raise RuntimeError(
253252
"ssl_context must be set before using adafruit_mqtt for secure MQTT."
254253
)
255-
print(key)
256254
addr_info = self._socket_pool.getaddrinfo(
257255
host, port, 0, self._socket_pool.SOCK_STREAM
258256
)[0]

0 commit comments

Comments
 (0)