Skip to content

Commit d8a8be7

Browse files
author
jef
committed
umqtt.robust: When reconnecting, close the previous socket.
1 parent a9e52d0 commit d8a8be7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

micropython/umqtt.robust/umqtt/robust.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ def log(self, in_reconnect, e):
2020
def reconnect(self):
2121
i = 0
2222
while 1:
23+
try:
24+
if self.sock:
25+
self.sock.close()
26+
except OSError as e:
27+
self.log(True, e)
2328
try:
2429
return super().connect(False)
2530
except OSError as e:

0 commit comments

Comments
 (0)