Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c30fe8

Browse files
authored
Added try/except around self.__mqttc.tls_set() (#33)
1 parent 59224e0 commit 4c30fe8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clearblade/Messaging.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,13 @@ def clear_will(self):
140140
def connect(self, will_topic=None, will_payload=1883):
141141
cbLogs.info("Connecting to MQTT.")
142142
if self.__use_tls:
143-
self.__mqttc.tls_set()
143+
try:
144+
self.__mqttc.tls_set()
145+
except ValueError as e:
146+
if str(e) == "SSL/TLS has already been configured.":
147+
pass
148+
else:
149+
raise e
144150
self.__mqttc.connect(self.__url, self.__port, self.__keepalive)
145151
self.__mqttc.loop_start()
146152

0 commit comments

Comments
 (0)