This PR explicitly calls disconnect() before connect(), and makes sure disconnect() is idempotent and does nos raise exceptions.
At least in ESP32, connection sockets are limited in number (8 or 10) and they pile up if not explicitly closed and/or garbage-collected. Calling connect() a number of times on umqtt.simple or umqtt.simple2 without explicit closure/gc eventually fails.
This PR explicitly calls disconnect() before connect(), and makes sure disconnect() is idempotent and does nos raise exceptions.
At least in ESP32, connection sockets are limited in number (8 or 10) and they pile up if not explicitly closed and/or garbage-collected. Calling connect() a number of times on umqtt.simple or umqtt.simple2 without explicit closure/gc eventually fails.