Commit 8595e36
committed
Close the socket when there is an error using the socket.
This fixes two related problems which made reconnecting not work after
the connection to the server gets dropped unexpectedly.
The MQTT client continues sending messages and on ESP32 eventually an
OSError is raised. The client must then reconnect. But reconnect was
failing because the Adafruit Connection Manager was returning the same
broken socket for the server since it hadn't yet been closed by
MiniMQTT.
Explicitly calling disconnect() would also not close the socket because
it tries to send the disconnect packet on the broken socket which raised
an OSError preventing the socket from being closed.1 parent bdcea6b commit 8595e36
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| 439 | + | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
| |||
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
594 | | - | |
| 595 | + | |
595 | 596 | | |
596 | 597 | | |
597 | 598 | | |
| |||
0 commit comments